Page 2 of 2

Re: Reformatting Input field in my JCL

PostPosted: Thu Mar 15, 2012 9:30 pm
by mathew28
In the first post form Mr. Frank, he has suggested to use DISP=MOD.

//You could use a DFSORT/ICETOOL job like the following to do what you want (be sure to use a MOD data set for //OUT):

to use DISP=MOD, the same member needs to be used, i.e an existing member is used.
How to fix this ?

Re: Reformatting Input field in my JCL

PostPosted: Thu Mar 15, 2012 9:39 pm
by BillyBoyo
Frank can have had no idea that you would want to apply his comment to a member on a PDS, because it won't work.

DISP=MOD for a PDS is not doing anything that you think it might be, and DISP=MOD for a member name is doing nothing.

If you look at the information supplied by Robert you can intuit that each time the member is opened it is expecting to be a new member and fails if the member already exists.

Have a look at this and see if it gives you any more clarity: http://ibmmainframes.com/about53730.html

I repeat, if you want the data as a member of a PDS, create it first on an ordinary sequential file, and copy that. Or change your last part to have its output as a seperate file, which is your member on a PDS.

Re: Reformatting Input field in my JCL

PostPosted: Thu Mar 15, 2012 10:32 pm
by Frank Yaeger
Matthew,

DISP=MOD does NOT make sense for a PDS member (you didn't originally mention that you wanted a PDS member for the output). Use a temporary MOD PS data set and then copy that to your PDS member like this:

//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=XXX028.TEST.INFILE(INPUT),DISP=SHR
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=XXX028.TEST.OUTFILE(OUTFIL1),DISP=OLD
//TOOLIN DD *
SUBSET FROM(IN) TO(T1) KEEP INPUT FIRST USING(CTL1)
SUBSET FROM(IN) TO(T1) REMOVE INPUT FIRST LAST USING(CTL2)
SUBSET FROM(IN) TO(T1) KEEP INPUT LAST USING(CTL3)
COPY FROM(T1) TO(OUT)
//CTL1CNTL DD *
  INREC BUILD=(C'(''',1,9,C''',',80:X)
//CTL2CNTL DD *
  INREC BUILD=(C'''',1,9,C''',',80:X)
//CTL3CNTL DD *
  INREC BUILD=(C'''',1,9,C''' )',80:X)
/*

Re: Reformatting Input field in my JCL

PostPosted: Fri Mar 16, 2012 12:43 am
by mathew28
Thank you very much Frank and others for the timely help.

The issue is resolved successfully..

Re: Reformatting Input field in my JCL

PostPosted: Tue Mar 20, 2012 9:01 pm
by mathew28
Hi,

I have one more request please help.

i have a input file in the format

QC12345
1442134213
1411412412
1414124414
:
:

I also have another file which is a PROC having

//ERCRPT1 PROC
//
:
:

I need to include a step in my job using DFSORT to take the first record in the input file and do some formatting and then include it in the PROC.

//IN DD DSN=XXXX28.TEST.INFILE(INPUT1),DISP=SHR
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=XXXX28.TEST.JCLPROC(ERCRPT2),DISP=OLD
//TOOLIN DD *
SUBSET FROM(IN) TO(T1) KEEP INPUT FIRST USING(CTL1)
COPY FROM(T1) TO(OUT)
//CTL1CNTL DD *
INREC BUILD = (C'QCNAME=',1,7,80:X) /******* I 'll get the first record from the input file

Can we direct insert the first record in the PROC like shown below ?

//ERCRPT1 PROC QCNAME=QC12345
//

Or should we create the whole first line in a new file and then merge it with the PROC like ?

INREC BUILD = (C'//ERCRPT1 PROC QCNAME=',1,7,80:X)

Please provide a better solution. Thanks in advance

Re: Reformatting Input field in my JCL

PostPosted: Tue Mar 20, 2012 9:57 pm
by mathew28
Hi Frank and Others,

My Input file changed such that the first record is different , I need to use it for a different purpose

Input File:

QC12345
123456789
123456789
123456789
123456789
123456789
123456789
123456789

Output File:

('123456789',
'123456789',
'123456789',
'123456789',
'123456789',
'123456789',
'123456789')

Another Output file (PROC):

//ERCRPT1 PROC QCNAME=QC12345


//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=XXXX28.TEST.INFILE(INPUT1),DISP=SHR
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=XXXX28.TEST.JCLPROC(ERCRPT2),DISP=OLD
//OUT2 DD DSN=XXXX28.TEST.OUTFILE(OUTFIL1),DISP=OLD
//* DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(2,1),RLSE),
//* RECFM=FB,LRECL=500
//TOOLIN DD *
SUBSET FROM(IN) TO(T1) KEEP INPUT FIRST USING(CTL1)
SUBSET FROM(IN) TO(T2) REMOVE INPUT FIRST LAST USING(CTL2)
SUBSET FROM(IN) TO(T2) KEEP INPUT LAST USING(CTL3)
COPY FROM(T1) TO(OUT)
COPY FROM(T2) TO(OUT2)
//CTL1CNTL DD *
INREC BUILD=(C'//ERCRPT1 PROC QCNAME=',1,7,80:X)
//CTL2CNTL DD *
INREC BUILD=(C'''',1,9,C''',',80:X)
//CTL3CNTL DD *
INREC BUILD=(C'''',1,9,C''' ) WITH UR;',80:X)
//*
//

I got the output incorrectly, since my first record has now become second record. So the output has become.

like:
Output file:

'123456789',
'123456789',
'123456789',
'123456789',
'123456789',
'123456789')

Another Output file (PROC):

//ERCRPT1 PROC QCNAME=QC12345

The first " (' " is missing in the first record in the output file. It is now the second record in the input file. So, please suggest how to include this in the second record only.

Please help.

Re: Reformatting Input field in my JCL

PostPosted: Wed Mar 21, 2012 12:09 am
by Frank Yaeger
Here's a DFSORT/ICETOOL job for your new requirement:

//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN       DD DSN=XXXX28.TEST.INFILE(INPUT1),DISP=SHR
//T1       DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT      DD DSN=XXXX28.TEST.JCLPROC(ERCRPT2),DISP=OLD
//OUT2     DD DSN=XXXX28.TEST.OUTFILE(OUTFIL1),DISP=OLD
//TOOLIN DD *
 SUBSET FROM(IN) TO(OUT) KEEP INPUT FIRST USING(CTL1)             
 SUBSET FROM(IN) TO(T1) KEEP INPUT RRN(2) USING(CTL2)             
 SUBSET FROM(IN) TO(T1) REMOVE INPUT FIRST(2) LAST USING(CTL3)   
 SUBSET FROM(IN) TO(T1) KEEP INPUT LAST USING(CTL4)               
 COPY FROM(T1) TO(OUT2)                                           
//CTL1CNTL DD *
  INREC BUILD=(C'//ERCRPT1  PROC  QCNAME=',1,7,80:X)
//CTL2CNTL DD *
  INREC BUILD=(C'(''',1,9,C''',',80:X)
//CTL3CNTL DD *
  INREC BUILD=(C'''',1,9,C''',',80:X)
//CTL4CNTL DD *
  INREC BUILD=(C'''',1,9,C''' ) WITH UR;',80:X)
//*


My test gave the following output:

OUT1:

//ERCRPT1  PROC  QCNAME=QC12345   


OUT2:

('123456789',                 
'123456789',                 
'123456789',                 
'123456789',                 
'123456789',                 
'123456789',                 
'123456789' ) WITH UR;       

Re: Reformatting Input field in my JCL

PostPosted: Wed Mar 21, 2012 12:48 am
by mathew28
Thanks very much Frank for a simpler solution. I had tried the below and it too worked fine..

//STEP02   EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//IN       DD DSN=XXXX28.TEST.INFILE(INPUT1),DISP=SHR             
//T1       DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2       DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T3       DD DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT      DD DSN=XXXX28.TEST.JCLPROC(ERCRPT2),DISP=OLD           
//OUT2     DD DSN=XXXX28.TEST.OUTFILE(OUTFIL1),DISP=OLD           
//*           DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(2,1),RLSE),     
//*           RECFM=FB,LRECL=500                                   
//TOOLIN   DD *                                                   
  SUBSET FROM(IN) TO(T1) KEEP INPUT FIRST USING(CTL1)             
  SUBSET FROM(IN) TO(T2) REMOVE INPUT FIRST USING(CTL2)           
  SUBSET FROM(T2) TO(T3) KEEP INPUT FIRST USING(CTL3)             
  SUBSET FROM(T2) TO(T3) REMOVE INPUT FIRST LAST USING(CTL4)       
  SUBSET FROM(IN) TO(T3) KEEP INPUT LAST USING(CTL5)               
  COPY FROM(T1) TO(OUT)                                           
  COPY FROM(T3) TO(OUT2)                                           
//CTL1CNTL DD *                                                   
  INREC BUILD=(C'//SETLVL   SET QCNAME=',1,7,80:X)                 
//CTL2CNTL DD *                                                   
  INREC BUILD=(1,9,80:X)                                           
//CTL3CNTL DD *                                                   
  INREC BUILD=(C'(''',1,9,C''',',80:X)                             
//CTL4CNTL DD *                                 
  INREC BUILD=(C'''',1,9,C''',',80:X)           
//CTL5CNTL DD *                                 
  INREC BUILD=(C'''',1,9,C''' ) WITH UR;',80:X) 
//*