IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Regarding writing fields in copybook as separate line


IBM Mainframe Forums -> FAQ & Basics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Chidane

New User


Joined: 25 Nov 2021
Posts: 11
Location: India

PostPosted: Fri Mar 04, 2022 6:00 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Fri Mar 04, 2022 6:40 pm
Reply with quote

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
View user's profile Send private message
Chidane

New User


Joined: 25 Nov 2021
Posts: 11
Location: India

PostPosted: Mon Mar 07, 2022 2:47 pm
Reply with quote

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
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Mon Mar 07, 2022 4:26 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Mon Mar 07, 2022 7:21 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> FAQ & Basics

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Two input files & writing counter... DFSORT/ICETOOL 12
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts rewrite same SAY line CLIST & REXX 8
Search our Forums:

Back to Top