View previous topic :: View next topic
|
Author |
Message |
Chidane
New User
Joined: 25 Nov 2021 Posts: 19 Location: India
|
|
|
|
Hi Team,
My requirement is to write each of the copybook field value in separate line in a dataset.
01 WS-DISPLAY-MSG.
05 WS-FIELD0 PIC X(20) VALUE 'THE RECORD LAYOUT IS'
05 WS-FIELD1A PIC X(14) VALUE 'FIELD VALUE IS'
05 WS-FIELD1 PIC X(10).
05 WS-FIELD2 PIC X(10).
05 WS-FIELD3 PIC X(2).
MOVE 'ABCDEFGHIJ' TO WS-FIELD1
MOVE 'KLMNOPQRS' TO WS-FIELD2
MOVE '10' TO WS-FIELD3
Eg of expected output
Code: |
THE RECORD LAYOUT IS
FIELD VALUE IS ABCDEFGHIJ
KLMNOPQRS
10 |
Is it possible to have the Output as above in Mainframe dataset with single WRITE.
Thanks |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2146 Location: USA
|
|
|
|
In zOS world, any dataset is considered as series of records, but not series of bytes (unlike other operating systems).
No special characters, like Carriage Return, or Line Feed can be used to "jump" to the next line (e.g. to the next record). This is the principal difference from many other operating systems (Unix, Windows, etc.)
The operator WRITE in COBOL is supposed to place a new record in the dataset (which is equivalent to new line). Please, RTFM carefully.
That's why there is no chance to create multiple records from one single WRITE statement.
P.S.
The original question has no minor relation to "writing fields in copybook" |
|
Back to top |
|
|
Chidane
New User
Joined: 25 Nov 2021 Posts: 19 Location: India
|
|
|
|
Ok thanks for the info. Understood.
So is it possible to break the single line to display it as multiple lines as per copybook layout mentioned.
Thanks |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
Yes, but that requires some form of program depending on where you want to "display" the data. You need to be more specific as to what you want to achieve.
Garry. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
This is very basic question. Moved to students section of this forum.
You need to write those many writes as you need per each field and define one common layout of 80 byes ( just an e.g) .
You can parse and build with slash operator using DFSORT. |
|
Back to top |
|
|
|