Page 1 of 1

query in String function

PostPosted: Thu Nov 20, 2008 8:01 pm
by radha.krishna
Hi,

I have a query in String function.
How can i write a record to new line using strings
Please look in the below code .

STRING
"Historical Flag" ","
"Future Flag" ","
"Active Flag" ","
"Item-Cancel" ","
"RCP" ","
"Pages" ","
"Status"
" "
W-CR-D
W-LF-D
DELIMITED BY SIZE
INTO
W-ITMUPD-HEADER
END-STRING.




the two variables
W-CR-D
W-LF-D
are defined in working storage section as
01 W-CR PIC 9(001) VALUE 13 COMP.
01 W-CR-D REDEFINES W-CR PIC X(1).
01 W-LF PIC 9(001) VALUE 10 COMP.
01 W-LF-D REDEFINES W-LF PIC X(1).


so request you to let me know the functionality of the variables W-CR-D and W-LF-D
purpose of using this variavles in the code .

Thanks,
radha

Re: query in String function

PostPosted: Fri Nov 21, 2008 7:50 am
by dick scherrer
Hello,

Those are carriage-return (CR - x'0D') and line-feed (LF - x'0A') characters. They aren't used as control characters on the mainframe - they are just data, but they may be used when the file is ftp'd to some unix or windows system.

Re: query in String function

PostPosted: Fri Nov 21, 2008 11:30 am
by radha.krishna
Thanks for the clarification.

Re: query in String function

PostPosted: Fri Nov 21, 2008 11:42 am
by radha.krishna
but i have few more queries on the same .....
then what is the significans of the value 13 passed to the variable

01 W-CR PIC 9(001) VALUE 13 COMP.

is it a standard form or can we use any other variables and can pass any value to the variable ?...

Re: query in String function

PostPosted: Sat Nov 22, 2008 1:56 am
by dick scherrer
Hello,

A decimal 13 is a hex 0D (base 10 versus base 16 numbers).

is it a standard form or can we use any other variables and can pass any value to the variable ?...
Transferring files requires a standard converntion be used between file creation and file usage.

The code must create the file in the format the "other end" is expecting.

CR/LF is rather common so i would not time investigating other values. And if what you have works, i would surely not change it without some business reason to do so.