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

Generating a Sequence and storing in file.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Wed Jun 24, 2009 2:51 pm
Reply with quote

Hi, I want to generate a sequence number and store in a file. Starting from 9999999 to 0000001 in descending order.

1. I tried using SELCOPY but it takes lot of time to execute the job.

2. Then i tried combination of IEBDG and and SYNCSORT something like below and it went quite fast (faster than first one).

Code:

//STEP1   EXEC PGM=IEFBR14                           
//DD1      DD DSN=OUT.LIST,DISP=(MOD,DELETE,DELETE) 
//STEP2   EXEC PGM=IEBDG                             
//SYSPRINT DD SYSOUT=*                               
//OUT      DD DSN=&&TEMP,DISP=(NEW,PASS),           
//          DCB=(RECFM=FB,LRECL=1,BLKSIZE=10000),   
//          SPACE=(CYL,(30,30),RLSE)                 
//SYSIN    DD *                                     
  DSD OUTPUT=(OUT)                                   
  FD NAME=FIELD1,LENGTH=1,PICTURE=1,'X'             
  CREATE QUANTITY=9999999,NAME=(FIELD1)             
  END                                               
/*                                                   
//STEP3 EXEC PGM=SYNCSORT                               
//SYSPRINT DD SYSOUT=*                               
//SYSOUT DD SYSOUT=*                                 
//SORTIN DD DSN=&&TEMP,DISP=(OLD,DELETE)             
//SORTOUT DD DSN=OUT.LIST,DISP=(NEW,KEEP,DELETE),   
// DCB=(RECFM=FB,LRECL=7,BLKSIZE=7000),       
// SPACE=(CYL,(50,30),RLSE)                   
//SYSIN DD *                                 
  INREC FIELDS=(1,1,X,SEQNUM,7,ZD)           
  SORT FIELDS=(3,7,ZD,D)                     
  OUTREC FIELDS=(3,7)                         
/*                                           


is there any way it can be done even in faster and better way ? icon_smile.gif

Thanks in advance.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 24, 2009 5:14 pm
Reply with quote

SAS can do that pretty quickly; a program probably would be the fastest once it's compiled.
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Wed Jun 24, 2009 5:42 pm
Reply with quote

Quote:
SAS can do that pretty quickly; a program probably would be the fastest once it's compiled.


thanks Robert.

please bear with my ignorance - what is SAS and why will it be faster ?

also, can IEBDG do this by itself (i mean can IEBDG do the function which SORT is doing) ?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 24, 2009 5:52 pm
Reply with quote

SAS is an independent software product from a private company called SAS Institute, Inc. It is a superb data manipulation tool. If your site has it, the code to generate a file of sequence numbers in reverse order would be:
Code:
DATA _NULL_ ;
     FILE OUTFILE ;
     DO I=9999999 TO 1 BY -1 ;
         PUT I Z8.;
     END;
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Jun 24, 2009 9:52 pm
Reply with quote

The following DFSORT JCL will give you the desired results


Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD *             
DUMMY RECORD 
//SORTOUT DD DSN=OUT.LIST,
//           DISP=(NEW,CATLG,DELETE),   
//           UNIT=SYSDA,
//           SPACE=(CYL,(50,30),RLSE) 
//SYSIN    DD *
  SORT FIELDS=COPY                                                 
  OUTFIL REPEAT=9999999,IFOUTLEN=7,                               
  IFTHEN=(WHEN=INIT,BUILD=(SEQNUM,7,ZD)),                         
  IFTHEN=(WHEN=INIT,OVERLAY=(1:+10000000,SUB,1,7,ZD,M11,LENGTH=7))
/*
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Wed Jun 24, 2009 10:03 pm
Reply with quote

Thanks Kolusu icon_smile.gif
Back to top
View user's profile Send private message
Nick Jones

New User


Joined: 28 Apr 2009
Posts: 13
Location: UK

PostPosted: Wed Jul 01, 2009 3:06 pm
Reply with quote

Quote:
"I tried using SELCOPY but it takes lot of time to execute the job."


I've executed some benchmark tests on our 28MIP Flex-es emulated z/OS server using Kolusu's sample SORT job and the following, equivalent SELCOPY job...

Code:
//STEP1    EXEC PGM=SELCOPY                                   
//SYSPRINT DD SYSOUT=*                                       
//OUTDD    DD DSN=NBJ.OUT.LIST.SELCOPY,DISP=(NEW,KEEP,DELETE),
//            DCB=(RECFM=FB,LRECL=7,BLKSIZE=7000),           
//            SPACE=(CYL,(50,30),RLSE)                       
//SYSIN    DD *                                               
   option worklen  20                                         
   pos  11 = x'9999,999c'                                     
==loop==                                                     
   if  4 at 11 type=p  =  0                                   
     then  goto eoj                                           
                                                             
  cvpc 4 at 11   to   7 at 1                                 
  write OUTDD                                                 
  sub   1  from  4 at 11                                     
  goto loop


There were only a few seconds difference between the two jobs, both taking in the region of 4 minutes to execute. (So some finger tapping is involved for this task whichever application you use. icon_wink.gif )

Note that, for any questions and information relating to SELCOPY, a SELCOPY group/forum is available via http://www.linkedin.com (registration required).
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 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