Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
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
 
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 OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts Changing sort Card Dynamically vickey_dw DFSORT/ICETOOL 5 Sat Aug 19, 2017 2:33 pm
No new posts Profile changed to NUMBER ON STD (fro... Martylin TSO/ISPF 1 Thu Aug 03, 2017 9:14 am
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us