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
 

 

Generating a Sequence and storing in file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Generating a Sequence and storing in file.
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: 7931
Location: Bellevue, IA

PostPosted: Wed Jun 24, 2009 5:14 pm    Post subject:
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    Post subject:
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: 7931
Location: Bellevue, IA

PostPosted: Wed Jun 24, 2009 5:52 pm    Post subject:
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    Post subject: Reply to: Generating a Sequence and storing in file.
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    Post subject:
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    Post subject: Reply to: Generating a Sequence and storing in file.
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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