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
 

 

How to generate variable number of records

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

New User


Joined: 25 Jan 2007
Posts: 32
Location: france

PostPosted: Fri Mar 27, 2015 12:49 pm    Post subject: How to generate variable number of records
Reply with quote

Hello,

I have to generate a variable number of records to an output file. In a symnames card I have this number of variable records. Is there a way to do this ?

Exemple
Code:

//SYMNAMES DD *                                           
NUMREC,5                                                   
*/                                                         
//INFILE   DD DUMMY,LRECL=80,RECFM=FB                     
//OUTPUT   DD DISP=(NEW,CATLG,DELETE),                     
//            DSN=&SYSUID..NEW.RECORDS,                   
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0,DSORG=PS), 
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSALLDA         


Expected output file
Code:

RECORD WITH VALUE 10
RECORD WITH VALUE 19
RECORD WITH VALUE 28
RECORD WITH VALUE 37
RECORD WITH VALUE 46


VALUE for the first record is 10 but for all other VALUE = previous VALUE + 9

Thanks for your help
Best regards
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Mar 27, 2015 1:56 pm    Post subject: Reply to: How to generate variable number of records
Reply with quote

OUTFIL REPEAT= will give you multiple output records per input record. REPEAT= up to DFSORT 2.1 can't use a symbol/SYMNAME. If you have 2.1, you may be lucky. If you don't, you'll have to use the symbol to generate the sort control cards to a dataset and run a second step using that dataset as the SYSIN.

To get your steps-of-nine from your starting point, temporarily extend the record to have a sequence number starting from zero, multiply by the sequence number by nine and add it to 10. Something like that.
Back to top
View user's profile Send private message
tuxama

New User


Joined: 25 Jan 2007
Posts: 32
Location: france

PostPosted: Fri Mar 27, 2015 6:29 pm    Post subject: Reply to: How to generate variable number of records
Reply with quote

Here, the piece of code I developed

The needed sysin :

Code:

  OPTION COPY
  OUTFIL REPEAT=5,IFOUTLEN=80,
   IFTHEN=(WHEN=INIT,OVERLAY=(90:SEQNUM,2,ZD,START=0,INCR=1)),
   IFTHEN=(WHEN=INIT,OVERLAY=(20:90,2,ZD,MUL,+9,ADD,+10,
                              M11,LENGTH=3))


Step S02 generates the expected sysin :

Code:

//S02      EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD *
NREC,'5'
IFT,'IFTHEN=(WHEN=INIT,'
/*
//SORTIN   DD DUMMY,LRECL=80,RECFM=FB
//SORTOUT  DD DISP=(NEW,CATLG,DELETE),
//            DSN=&SYSUID..REPEAT.T1,
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0,DSORG=PS),
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSALLDA
//SYSIN    DD *
  OPTION COPY
  OUTFIL REMOVECC,
   HEADER1=(2X,'OPTION COPY',/,
            2X,'OUTFIL REPEAT=',NREC,',IFOUTLEN=80,',/,
            3X,IFT,'OVERLAY=(90:SEQNUM,2,ZD,START=0,INCR=1)),',/,
            3X,IFT,'OVERLAY=(20:90,2,ZD,MUL,+9,ADD,+10,',/,
            30X,'M11,LENGTH=3))')
/*


Step S03 gives the final result :

Code:

//S03      EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
RECORD WHITH VALUE ---
/*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD DISP=SHR,DSN=&SYSUID..REPEAT.T1


Here are the contents of the sysout :

Code:

********************************* TOP OF DATA *******
RECORD WHITH VALUE 010
RECORD WHITH VALUE 019
RECORD WHITH VALUE 028
RECORD WHITH VALUE 037
RECORD WHITH VALUE 046
******************************** BOTTOM OF DATA *****


Thanks a lot Bill.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Mar 27, 2015 6:53 pm    Post subject: Reply to: How to generate variable number of records
Reply with quote

Thanks for posting your solution, and good work getting there.

I'd suggest you remove the DCB from the SORTOUT, SORT will do that, which means if it is in the JCL you'll have two places to maintain it.

The INCR=1 is not needed, as it is the default increment.
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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am


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