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

[Solved]How to append serial No. on records in output through JCL ?


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jun 07, 2007 9:38 pm
Reply with quote

Hi,

I was asked this question:

I have one input say: HLQ.TEMP.FILE, records in file are:
Code:
111   $$$$$
333   CCCCC
444   EEEEE
555   GGGGG
222   AAAAA


Using any utility in a JCL, get the outout as:
Code:
1.   111   $$$$$
2.   333   CCCCC
3.   444   EEEEE
4.   555   GGGGG
5.   222   AAAAA


I hope SORTs' OVERLAY or OUTFIL option can do this but I know to append the same value, I mean, can get the following out put easily using OVERLAY etc.:
Code:
1.   111   $$$$$
1.   333   CCCCC
1.   444   EEEEE
1.   555   GGGGG
1.   222   AAAAA


But how can I keep incrementing the appended value in column 1 of output? Please suggest.
Back to top
View user's profile Send private message
ranjanp

New User


Joined: 02 May 2006
Posts: 25

PostPosted: Thu Jun 07, 2007 11:27 pm
Reply with quote

Use a sort card like

//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(001:SEQNUM,1,ZD,002:C'.',006:001,75)
//*

SEQNUM parameter will take care of the numbering and the incrementing.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jun 08, 2007 1:55 pm
Reply with quote

Hey Thanks, I didn't think about SEQNUM verb. I am stupid enough..!
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top