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

SEQNUM : START= from field of the first record ?


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

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Thu Nov 12, 2009 12:12 am
Reply with quote

I've read it's possible to use SEQNUM followed by START=

But I wonder if the value could be taken from field of the 1st record, so that the procedure is full automatic

Ex. (pos. number=1 to 5 ; FLR = 8) :

00051AAA
00051AAA
00051AAB
00052ABD
00053ABD

must give :
00051AAA
00052AAB
00053ABD
00054ABD

Note : I use a SELECT FIRST... ON(1,8) to eliminate duplicate records on entire record length (8)
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: Thu Nov 12, 2009 12:33 am
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (FB)
//OUT DD DSN=...  output file (FB)
//TOOLIN DD *
COPY FROM(IN) TO(CTL2CNTL) USING(CTL1)
SELECT FROM(IN) TO(OUT) ON(1,8,CH) FIRST USING(CTL2)
/*
//CTL1CNTL DD *
  OPTION STOPAFT=1
  INREC BUILD=(C'  OUTFIL FNAMES=OUT,OVERLAY=(1:SEQNUM,5,ZD,START=',
    1,5,C')',80:X)
/*
//CTL2CNTL DD DSN=&&C2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Nov 12, 2009 12:47 am
Reply with quote

Searchman,

Here is an alternative way of getting the desired results

Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=your 8 byte FB file,DISP=SHR     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  SORT FIELDS=(1,8,CH,A),EQUALS                                       
  SUM FIELDS=NONE                                                     
  OUTREC IFOUTLEN=8,IFTHEN=(WHEN=INIT,OVERLAY=(9:SEQNUM,5,ZD,START=0)),
  IFTHEN=(WHEN=GROUP,BEGIN=(9,5,ZD,EQ,0),PUSH=(1:1,5)),               
  IFTHEN=(WHEN=(9,5,ZD,GT,0),                                         
  OVERLAY=(1:1,5,ZD,ADD,9,5,ZD,M11,LENGTH=5))                         
//*
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Thu Nov 12, 2009 2:38 am
Reply with quote

Thank you for the two solutions...
I find the first one (SELECT FIRST) quite elegant !
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top