query in String function



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

query in String function

Postby radha.krishna » Thu Nov 20, 2008 8:01 pm

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
radha.krishna
 
Posts: 9
Joined: Thu Nov 20, 2008 7:41 pm
Has thanked: 0 time
Been thanked: 0 time

Re: query in String function

Postby dick scherrer » Fri Nov 21, 2008 7:50 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: query in String function

Postby radha.krishna » Fri Nov 21, 2008 11:30 am

Thanks for the clarification.
radha.krishna
 
Posts: 9
Joined: Thu Nov 20, 2008 7:41 pm
Has thanked: 0 time
Been thanked: 0 time

Re: query in String function

Postby radha.krishna » Fri Nov 21, 2008 11:42 am

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 ?...
radha.krishna
 
Posts: 9
Joined: Thu Nov 20, 2008 7:41 pm
Has thanked: 0 time
Been thanked: 0 time

Re: query in String function

Postby dick scherrer » Sat Nov 22, 2008 1:56 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post