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

Sequence number genaration, intial num from otr file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vasantha.gl

New User


Joined: 23 Sep 2011
Posts: 12
Location: Chennai

PostPosted: Thu Mar 29, 2012 10:16 am
Reply with quote

I have a input file(File1) and I want to generate sequence number in a output file(File3)
Starting number to generate the sequence number i need to get from other file(File2).

Can any one help me out to resolve this issue. icon_confused.gif
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Thu Mar 29, 2012 10:44 am
Reply with quote

Hello,

Quote:
Can any one help me out to resolve this issue.


Post the I/P files (File 1,File 2) and O/P file (File 3) layout, only you could explain this better.

Also, ensure DFSORT is installed at your site.
Back to top
View user's profile Send private message
vasantha.gl

New User


Joined: 23 Sep 2011
Posts: 12
Location: Chennai

PostPosted: Thu Mar 29, 2012 11:13 am
Reply with quote

File 1 Layout RECFM=FB,LRECL=80
File 2 Layout RECFM=FB,LRECL=80 sequence number Start is present at 10 position
File 3 Layout RECFM=FB,LRECL=80 generate sequence number at 10 position
sEQUENCE NUMBER IS ZD(LENGTH 6)

In Brief :
(get the sequence number from File2(10th position) and generate the next sequence numbers in File3(10th position))

we can Ignore File1 in picture.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Mar 29, 2012 11:42 am
Reply with quote

Hi,

how many records are in file2 ?



Gerry
Back to top
View user's profile Send private message
vasantha.gl

New User


Joined: 23 Sep 2011
Posts: 12
Location: Chennai

PostPosted: Thu Mar 29, 2012 11:47 am
Reply with quote

There are 12 records in the file2. Need to take Last record(12th) 10th position and start generating the sequence number in file3 10th position.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Mar 29, 2012 2:19 pm
Reply with quote

Hi,

try this
Code:
//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *           File2                                           
         000001                                                     
         000002                                                     
         000003                                                     
         000004                                                     
         000005                                                     
         000006                                                     
         000007                                                     
         000008                                                     
         000009                                                     
         000010                                                     
         000011                                                     
         000012                                                     
/*                                                                   
//SORTOUT  DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1)),DISP=(,PASS)       
//SYSIN    DD *                                                     
  OPTION COPY,SKIPREC=11                                             
  OUTREC BUILD=(C' OUTREC OVERLAY=(10:SEQNUM,6,ZD,START=',           
                10,6,ZD,ADD,+1,EDIT=(TTTTTT),C')',80:X)             
/*                                                                   
//STEP0200 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *          File1                                           
1                                                                   
2                                                                   
3                                                                   
/*                                                                   
//SORTOUT  DD SYSOUT=*   File3                                     
//SYSIN    DD *                                                     
  OPTION COPY                                                       
/*                                                                   
//         DD DSN=&&S1,DISP=(OLD,DELETE)                             



Gerry
Back to top
View user's profile Send private message
vasantha.gl

New User


Joined: 23 Sep 2011
Posts: 12
Location: Chennai

PostPosted: Thu Mar 29, 2012 3:36 pm
Reply with quote

Yes, The above code is working. Thanks a lot for your support.

But I have a Last change in this.
How can I write generated sequence number into File3 in 89th position(STEP0200 step).

Thanks in Advance icon_question.gif
Back to top
View user's profile Send private message
vasantha.gl

New User


Joined: 23 Sep 2011
Posts: 12
Location: Chennai

PostPosted: Thu Mar 29, 2012 4:38 pm
Reply with quote

Thanks I got it.

By changing OUTREC to 86, i got what was expecting icon_lol.gif
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Mar 30, 2012 8:46 am
Reply with quote

Hi,

this is another way of achieving the same, this time we extract the last record regardless of the number of records on input file.
Code:
//STEP0300 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//IN       DD *                                                 
         000001                                                 
         000002                                                 
         000003                                                 
         000004                                                 
         000005                                                 
         000006                                                 
         000007                                                 
         000008                                                 
         000009                                                 
         000010                                                 
         000011                                                 
         000012                                                 
//*                                                             
//OUT      DD DSN=&&S2,UNIT=SYSDA,SPACE=(TRK,(1)),DISP=(,PASS)   
//TOOLIN   DD *                                                     
 SUBSET FROM(IN) TO(OUT) KEEP INPUT LAST USING(CTL1)                 
//*                                                                 
//CTL1CNTL DD *                                                     
  OPTION COPY                                                       
  OUTFIL BUILD=(C' OUTREC OVERLAY=(10:SEQNUM,6,ZD,START=',           
                10,6,ZD,ADD,+1,EDIT=(TTTTTT),C')',80:X)             
//STEP0400 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                     
1                                                                   
2                                                                   
3                                                                   
/*                                                                   
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  OPTION COPY                                                       
/*                                                                   
//         DD DSN=&&S2,DISP=(OLD,DELETE)                             


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

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Mar 30, 2012 10:27 pm
Reply with quote

gcicchet,

I would suggest using reporting features TRAILER1 to pick the last record instead of subset as it would need 2 passes of data to get the last record.

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
         000101                                                 
         000102                                                 
         000103                                                 
         000104                                                 
         000015                                                 
         000116                                                 
         000107                                                 
         000108                                                 
         000109                                                 
         000010                                                 
         000111                                                 
         000212                                                 
//SORTOUT  DD DSN=&&S1,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)     
//SYSIN    DD *                                                 
  OPTION COPY                                                   
  INREC BUILD=(10,6,ZD,ADD,+1,EDIT=(TTTTTT))                   
  OUTFIL REMOVECC,NODETAIL,BUILD=(80X),                         
  TRAILER1=(' OPTION COPY',/,                                   
            ' OUTREC OVERLAY=(10:SEQNUM,6,ZD,START=',1,6,C')') 
//*                                                             
//STEP0200 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
1                                                               
2                                                               
3                                                               
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD DSN=&&S1,DISP=SHR                                 
//*
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top