Reformatting Input field in my JCL



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Re: Reformatting Input field in my JCL

Postby mathew28 » Thu Mar 15, 2012 9:30 pm

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 ?
mathew28
 
Posts: 30
Joined: Tue Oct 20, 2009 11:06 am
Has thanked: 0 time
Been thanked: 0 time

Re: Reformatting Input field in my JCL

Postby BillyBoyo » Thu Mar 15, 2012 9:39 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Reformatting Input field in my JCL

Postby Frank Yaeger » Thu Mar 15, 2012 10:32 pm

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)
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Reformatting Input field in my JCL

Postby mathew28 » Fri Mar 16, 2012 12:43 am

Thank you very much Frank and others for the timely help.

The issue is resolved successfully..
mathew28
 
Posts: 30
Joined: Tue Oct 20, 2009 11:06 am
Has thanked: 0 time
Been thanked: 0 time

Re: Reformatting Input field in my JCL

Postby mathew28 » Tue Mar 20, 2012 9:01 pm

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
mathew28
 
Posts: 30
Joined: Tue Oct 20, 2009 11:06 am
Has thanked: 0 time
Been thanked: 0 time

Re: Reformatting Input field in my JCL

Postby mathew28 » Tue Mar 20, 2012 9:57 pm

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.
mathew28
 
Posts: 30
Joined: Tue Oct 20, 2009 11:06 am
Has thanked: 0 time
Been thanked: 0 time

Re: Reformatting Input field in my JCL

Postby Frank Yaeger » Wed Mar 21, 2012 12:09 am

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;       
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Reformatting Input field in my JCL

Postby mathew28 » Wed Mar 21, 2012 12:48 am

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) 
//*
mathew28
 
Posts: 30
Joined: Tue Oct 20, 2009 11:06 am
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post