|
|
| Author |
Message |
genesis786
Active User
Joined: 28 Sep 2005 Posts: 184 Location: St Katherine's Dock London
|
|
|
|
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 ?
Thanks in advance. |
|
| Back to top |
|
 |
References
|
|
 |
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 4259 Location: Atlanta, GA
|
|
|
|
| SAS can do that pretty quickly; a program probably would be the fastest once it's compiled. |
|
| Back to top |
|
 |
genesis786
Active User
Joined: 28 Sep 2005 Posts: 184 Location: St Katherine's Dock London
|
|
|
|
| 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 |
|
 |
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 4259 Location: Atlanta, GA
|
|
|
|
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 |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 961 Location: San Jose
|
|
|
|
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 |
|
 |
genesis786
Active User
Joined: 28 Sep 2005 Posts: 184 Location: St Katherine's Dock London
|
|
|
|
Thanks Kolusu  |
|
| Back to top |
|
 |
Nick Jones
New User
Joined: 28 Apr 2009 Posts: 13 Location: UK
|
|
|
|
| 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. )
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 |
|
 |
|
|
|