Page 2 of 2

Re: dynamic jcl through Rexx

PostPosted: Sun Jun 09, 2013 11:19 am
by coolpinky
Sort will only allow me to split the files..however i need o create file name dynamically and process those..I dont think sort can do this..

Re: dynamic jcl through Rexx

PostPosted: Sun Jun 09, 2013 12:57 pm
by enrico-sorichetti
this snippet will build a reasonable jcl according to Your input

 ****** ***************************** Top of Data ******************************
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  4 Line(s) not Displayed
 000005 //S1      EXEC PGM=SORT
 000006 //SYSPRINT  DD SYSOUT=*
 000007 //SYSOUT    DD SYSOUT=*
 000008 //SORTIN    DD *
 000009 1234 ... ... ...
 000010 2345 ... ... ...
 000011 2345 ... ... ...
 000012 3456 ... ... ...
 000013 3456 ... ... ...
 000014 3456 ... ... ...
 000015 4567 ... ... ...
 000016 4567 ... ... ...
 000017 4567 ... ... ...
 000018 4567 ... ... ...
 000019 //JCL       DD DISP=(,PASS),DSN=&JCL,
 000020 //             DCB=(RECFM=FB,LRECL=80),
 000021 //             UNIT=VIO,SPACE=(TRK,(1,1))
 000022 //CTL       DD DISP=(,PASS),DSN=&CTL,
 000023 //             DCB=(RECFM=FB,LRECL=80),
 000024 //             UNIT=VIO,SPACE=(TRK,(1,1))
 000025 //SYSIN     DD *
 000026   OPTION COPY
 000027   INREC  OVERLAY(81:SEQNUM,4,ZD,RESTART=(1,4))
 000028   OUTFIL FNAMES=JCL,
 000029     INCLUDE=(81,4,ZD,EQ,1),
 000030     REMOVECC,
 000031     HEADER1=('//SPLIT    JOB NOTIFY=&SYSUID,                ',/,
 000032              '//             CLASS=A,MSGCLASS=X,            ',/,
 000033              '//             MSGLEVEL=(1,1)                 ',/,
 000034              '//*                                           ',/,
 000035              '//S       EXEC PGM=SORT                       ',/,
 000036              '//SYSPRINT  DD SYSOUT=*                       ',/,
 000037              '//SYSOUT    DD SYSOUT=*                       ',/,
 000038              '//SORTIN    DD DISP=SHR,DSN=XXXX.YYYY.IN'),
 000039     TRAILER1=('//SYSIN    DD *'),
 000040     BUILD=(1:C'//OU',1,4,13:C'DD DISP=(,CATLG),',80:X,/,
 000041            1:C'//',16:C'DSN=XXXX.YYYY.OU',1,4,C',',80:X,/,
 000042            1:C'//',16:C'UNIT=SYSDA,SPACE=(CYL,(1,1)),',80:X,/,
 000043            1:C'//',16:C'DCB=(RECFM=FB,LRECL=80)',80:X)
 000044   OUTFIL FNAMES=CTL,
 000045     INCLUDE=(81,4,ZD,EQ,1),
 000046     REMOVECC,
 000047     HEADER1=('  OPTION COPY'),
 000048     TRAILER1=('/*',/,'//'),
 000049     BUILD=(3:C'OUTFIL FNAMES=OU',1,4,
 000050                       C',INCLUDE=(1,4,CH,EQ,C''',1,4,C''')',80:X)
 000051 //S2      EXEC PGM=SORT
 000052 //SYSPRINT  DD SYSOUT=*
 000053 //SYSOUT    DD SYSOUT=*
 000054 //SORTIN    DD DISP=(OLD,PASS),DSN=&JCL
 000055 //          DD DISP=(OLD,PASS),DSN=&CTL
 000056 //SORTOUT   DD SYSOUT=*
 000057 //SYSIN     DD *
 000058   OPTION COPY
 ****** **************************** Bottom of Data ****************************

Re: dynamic jcl through Rexx

PostPosted: Sun Jun 09, 2013 9:35 pm
by coolpinky
1234 ...key is not fixed..It is a random number generated by system so it cannot be defined.

Re: dynamic jcl through Rexx

PostPosted: Sun Jun 09, 2013 10:14 pm
by enrico-sorichetti
before criticizing did You try to run the snippet posted as is
did You run it and tried to understand it ?
it will behave properly for any key composed of 4 alpha numerics ( upper case letters and numbers ).

Do you realize that today is sunday and psychic day is wednesday.
( being able to guess what You want for a poor description of the requirement )

if You want good answers learn to post better questions.

the snippet as posted satisfied the description of the requirement
( it was posted as is for a similar request on the sibling forum )

a better description would have told ..
the position, length, format of the key ...
the number of different keys

Re: dynamic jcl through Rexx

PostPosted: Mon Jun 10, 2013 10:44 am
by coolpinky
I tried running the rexx code.
I got maxx cc-0 but my files are not alllocated

I used the below jcl
//STEP1 EXEC PGM=IKJEFT01
//SYSEXEC  DD DSN=HLQ.PINKY.CTLLIB(REXX4),DISP=SHR
//SYSTSPRT DD  SYSOUT=*
//TULIN    DD  DSN=HLQ.PINKY.REXX.INPUT3,DISP=SHR
//SYSTSIN  DD  DUMMY


Rexx code is :
/* REXX */
LASTKEY = ''
DSN     = ''
DROP RECORD.
"EXECIO 1 DISKR TULIN"
DO WHILE (RC=0)
  PULL RECORD.1
  THISKEY = SUBSTR(RECORD.1,1,4)

  IF (THISKEY¬LASTKEY) THEN DO
    IF (LASTKEY¬='') THEN DO
      "EXECIO 0 DISKW TULOUT (FINIS"
      "FREE FI(TULOUT)"
      ADDRESS ISPEXEC "FTOPEN  TEMP"
      ADDRESS ISPEXEC "FTINCL  FOO"
      ADDRESS ISPEXEC "FTCLOSE"
      ADDRESS ISPEXEC "VGET ZTEMPF"
      "SUBMIT '"ZTEMPF"'"
      DSN = "HLQ.PINKY"D.THISKEY
      "ALLOC FI(TULOUT) DA("DSN") NEW SPACE(1,1) TRACKS LRECL(80)",
            "RECFM(F B)"
END
LASTKEY = THISKEY
      END

      "EXECIO 1 DISKW TULOUT (STEM RECORD.)"
      "EXECIO 1 DISKR TULIN"

Can you guide why files are not allocated

Code'd

Re: dynamic jcl through Rexx

PostPosted: Mon Jun 10, 2013 11:38 am
by BillyBoyo
Please use the Code tags to preserve spacing, use the Preview button to ensure your posting looks like how you want it to look.

Re: dynamic jcl through Rexx

PostPosted: Mon Jun 10, 2013 3:29 pm
by Akatsukami
coolpinky wrote:I tried running the rexx code.
I got maxx cc-0 but my files are not alllocated

I used the below jcl
//STEP1 EXEC PGM=IKJEFT01
//SYSEXEC  DD DSN=HLQ.PINKY.CTLLIB(REXX4),DISP=SHR
//SYSTSPRT DD  SYSOUT=*
//TULIN    DD  DSN=HLQ.PINKY.REXX.INPUT3,DISP=SHR
//SYSTSIN  DD  DUMMY

  1. Add a TRACE I (or R) statement at the beginning and re-run it.
  2. You do have ALTER access to HLQ, yes?
  3. To short-circuit the next complaint, viz., "My jobs aren't getting submitted!", you evidently didn't bother to read
    I assume that you're running this in background ISPF

    You're not; you're running background TSO.