Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

I have to insert a blank line after every 18th record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Deepa.m
Warnings : 1

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Thu Jan 03, 2008 4:02 am    Post subject: I have to insert a blank line after every 18th record
Reply with quote

The LRECL is 121. We have text lines one below the other. For better presentation, we want to insert a blank line after every 18th line.

RECFM= FB
RECL=121.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jan 03, 2008 5:30 am    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/121)
//SORTOUT DD DSN=...  output file (FB/121)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL IFOUTLEN=121,
   IFTHEN=(WHEN=INIT,
     OVERLAY=(122:SEQNUM,8,ZD,START=0,
         130:122,8,ZD,MOD,+18,TO=ZD,LENGTH=2)),
   IFTHEN=(WHEN=(130,2,ZD,EQ,+17),
     BUILD=(1,121,/,X))
/*
Back to top
View user's profile Send private message
Prabha
Warnings : 2

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Thu Jan 03, 2008 4:29 pm    Post subject: Reply to: I have to insert a blank line after every 18th rec
Reply with quote

Could you pls explain yr code..

OUTFIL IFOUTLEN=121,
IFTHEN=(WHEN=INIT,
OVERLAY=(122:SEQNUM,8,ZD,START=0,
130:122,8,ZD,MOD,+18,TO=ZD,LENGTH=2)),
IFTHEN=(WHEN=(130,2,ZD,EQ,+17),
BUILD=(1,121,/,X))
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Thu Jan 03, 2008 5:12 pm    Post subject: Reply to: I have to insert a blank line after every 18th rec
Reply with quote

Prabha,

Find below the explanations.

Code:
OUTFIL IFOUTLEN=121,


IFOUTLEN=121 parameter tells DFSORT that the length you want to use for the reformatted records is 121.

Code:
IFTHEN=(WHEN=INIT,
OVERLAY=(122:SEQNUM,8,ZD,START=0,


For all the records in the input file, we are generating the 8-byte ZD sequence number in the position 122. The sequence no starts from 00000000 and increments by 1.

Code:
130:122,8,ZD,MOD,+18,TO=ZD,LENGTH=2)),


Puts the result in position 130
122,8,ZD,MOD,+18 -> This gets the remainder (modulus) of the 8 byte ZD seqnum divided by 18.
TO=ZD,LENGTH=2 -> The reminder is stored with length 2.

The sequence number starts from 0 and hence your 18th record will have the sequence number as 00000017. The remainder is 17 When the sequence number in the 18th record, 36th record, etc is divided by 18.

Code:
IFTHEN=(WHEN=(130,2,ZD,EQ,+17),
BUILD=(1,121,/,X))


When the remainder is 17, we are building the first 121 bytes (required bytes) and then writing a new blank line (/,X). The other records are just copied without changes.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jan 03, 2008 10:11 pm    Post subject:
Reply with quote

Aaru,

Pretty good explanation. I edited it a bit for clarity.

Prabha,

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Fri Jan 04, 2008 11:17 am    Post subject: Reply to: I have to insert a blank line after every 18th rec
Reply with quote

Frank,

Quote:
Pretty good explanation.


Thanks.

Quote:
I edited it a bit for clarity


Yes, Now the explanation looks great. Thanks.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us