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
 

 

Including serial number using SORT

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

New User


Joined: 03 Apr 2007
Posts: 5
Location: India

PostPosted: Thu Jun 28, 2007 1:16 am    Post subject: Including serial number using SORT
Reply with quote

Hi

I have an input file with record length 59. I need to include a column in the begining of the record which is a serial number.

Example:
Assume i have 3 records in the input file as given below.

AAAAAAA
BBBBBBB
CCCCCC

My output file should be as follows. I assumed the lenght of the serial number to be 4 bytes.

0001AAAAAAA
0002BBBBBBB
0003CCCCCC

Can this be possible using SORT utility?
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Jun 28, 2007 1:41 am    Post subject:
Reply with quote

The sort manual refers to that as a sequence number, and it can be added during input or output.
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 Jun 28, 2007 2:31 am    Post subject:
Reply with quote

madhiolli,

Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/84)
//SYSIN DD *
  OPTION COPY
  INREC BUILD=(SEQNUM,4,ZD,1,80)
/*
Back to top
View user's profile Send private message
madhiolli

New User


Joined: 03 Apr 2007
Posts: 5
Location: India

PostPosted: Thu Jun 28, 2007 7:18 pm    Post subject: Re: Including serial number using SORT
Reply with quote

Thanks Frank and William.

Mean while i tried this with OUTREC and INCR option using SORT utility. It works too.
But Frank yours is simplest.

Code:

  OPTION COPY
  OUTREC FIELDS=(SEQNUM,04,ZD,START=00000001,INCR=1,
                           5:1,80)
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 Jun 28, 2007 9:25 pm    Post subject:
Reply with quote

My control statement and your control statement are equivalent.

You can use INREC or OUTREC interchangeably in this case.

BUILD= is the same as FIELDS=, although BUILD= is preferred since it can be used for INREC, OUTREC and OUTFIL whereas FIELDS= can only be use for INREC and OUTREC and OUTREC= must be used for OUTFIL.

START=1 and INCR=1 are the defaults, so you don't need to specify START=00000001 and INCR=1, but you can if you want to.

5: is the default in this case, so you don't have to specify it, but you can if you want to.
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 Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts what is meaning of the number in dcl Martylin PL/I & Assembler 2 Thu Mar 09, 2017 7:18 am
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm


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