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

Insert sequence number


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nazia.lalani
Warnings : 1

New User


Joined: 20 Mar 2009
Posts: 25
Location: hyderabad

PostPosted: Fri Sep 11, 2009 10:12 am
Reply with quote

I want to insert the sequence number at the end of the record depending on icn

ICN sequwnce number

00000001 1
00000001 2
00000001 3
00000001 4
00000002 1
00000002 2

Can any body suggest any solution?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Sep 11, 2009 10:42 am
Reply with quote

Hi,

insert what sequence number ? where is the end of the record ?what is the LRECL ? RECFM ?.

Give example on what the output will look like.

You need to explain what is needed a lot clearer than you have done so far.


Gerry
Back to top
View user's profile Send private message
nazia.lalani
Warnings : 1

New User


Joined: 20 Mar 2009
Posts: 25
Location: hyderabad

PostPosted: Fri Sep 11, 2009 10:49 am
Reply with quote

consider the input file is fixed byte and lrec=80
i want to insert sequence number at 81 position

INPUT file has ICN and other fields i want sequence number depending on ICN
1-
80
ICN other fields
00000001 ............................................................
00000001 ............................................................
00000001 ............................................................
00000001 ............................................................
00000002 ............................................................
00000002 ............................................................

output file
INPUT file
1- 81

00000001 ............................................................1
00000001 ............................................................2
00000001 ............................................................ 3
00000001 ............................................................4
00000002 ............................................................1
00000002 ............................................................ 2
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Sep 11, 2009 10:56 am
Reply with quote

Hi,

try this
Code:
//STEP0001 EXEC PGM=SORT                                               
//SORTIN   DD *                                                         
00000001 ............................................................   
00000001 ............................................................   
00000001 ............................................................   
00000001 ............................................................   
00000002 ............................................................   
00000002 ............................................................   
//SORTOUT  DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=(1,8,BI,A)                                               
  OUTREC OVERLAY=(81:SEQNUM,3,ZD,RESTART=(1,8))                         


Gerry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri Sep 11, 2009 9:14 pm
Reply with quote

Nazia,

If the records are already in order as shown in your example, you can use a copy application which is more efficient than a sort application. Just replace the SORT statement with:

Code:

    SORT FIELDS=COPY
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Cobol program with sequence number ra... COBOL Programming 5
Search our Forums:

Back to Top