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 Profile Log in to check your private messages Log in
 
[Solved]How to append serial No. on records in output through JCL ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
Anuj Dhawan

Senior Member


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

PostPosted: Thu Jun 07, 2007 9:38 pm    Post subject: How to append serial No. on records in output through JCL ?
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    Post subject:
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

Senior Member


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

PostPosted: Fri Jun 08, 2007 1:55 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Hardcoded negative sign value in output scdinesh SYNCSORT 8 Fri Sep 08, 2017 5:28 am
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm

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