Page 1 of 2

Reformatting Input field in my JCL

PostPosted: Thu Mar 15, 2012 12:38 am
by mathew28
Hi,

Thanks for checking this.

I have a file in the below format which is ftped.

123456789
123456789
123456789
123456789

It is 9 digit numbers one below the other n number of times each time.

I want to create an input file in the below format,

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

The number should be preceded by " ' " and followed by " ' " and ",". The last number should not be followed by " , ".

I tried to use the DFSORT reformatting options but I'm facing errors, I'm not able to do for the symbol " ' " but other symbols "$" worked.

OUTREC FIELDS = (C'$',1,9,C',',12:X)

The output came as

$123456789,
$123456789,
$123456789,
$123456789,

I wanted all the remaining space after "," to be blanks, so gave 12:X. But only the 12th position became blank. What needs to be given to make all remaining space as blank ?

Please help me resolve this issue to create the input file in the required format. Thanks in advance.

Re: Reformatting Input field in my JCL

PostPosted: Thu Mar 15, 2012 1:58 am
by Frank Yaeger
The correct syntax for your OUTREC statement would be:

   OUTREC FIELDS=(C'''',1,9,C''',',80:X)       


Note that you need to use '' (two apostrophes) for ' (one apostrophe). 80:X will pad with blanks to position 80. 12:X would pad with blanks to position 12, whereas 12X would add 12 blanks.

However, that would NOT give you the output you want for the first and last records.

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):

//S1    EXEC  PGM=ICETOOL                                       
//TOOLMSG DD SYSOUT=*                                           
//DFSMSG  DD SYSOUT=*                                           
//IN DD DSN=...  input file (FB/80)
//OUT DD DISP=MOD,DSN=...  output file (FB/80)   
//TOOLIN DD *                                                   
SUBSET FROM(IN) TO(OUT) KEEP INPUT FIRST USING(CTL1)             
SUBSET FROM(IN) TO(OUT) REMOVE INPUT FIRST LAST USING(CTL2)     
SUBSET FROM(IN) TO(OUT) KEEP INPUT LAST USING(CTL3)             
//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: Thu Mar 15, 2012 2:24 am
by mathew28
Thank you very much Frank. The correct syntax worked perfectly. I was pretty close, I tried OUTREC FIELDS=(C''',1,9,C'',',80:X), with one apostrophe missing.
Now that worked fine.

Also, tried to format the first and last record with ICETOOL with the given code, earlier I had used PGM=SORT.
But I'm getting an abend ABEND SB14. No idea whats wrong !!

Please help.

Re: Reformatting Input field in my JCL

PostPosted: Thu Mar 15, 2012 2:48 am
by Frank Yaeger
Also, tried to format the first and last record with ICETOOL with the given code, earlier I had used PGM=SORT.
But I'm getting an abend ABEND SB14. No idea whats wrong !!

Please help.


I don't know what you want help with. You say "earlier I used PGM=SORT", but I don't know what you tried to do with PGM=SORT. If you tried to use ICETOOL via PGM=SORT, then that wouldn't work. You need to use PGM=ICETOOL and the correct JCL for ICETOOL.

ABEND SB14 is a CLOSE problem. Since I don't know what your JCL looks like and you didn't show the JES log, I have nothing to go on to help you figure out what's wrong. You could start by looking up the IEC217I message associated with the SB14 ABEND.

Re: Reformatting Input field in my JCL

PostPosted: Thu Mar 15, 2012 5:12 am
by steve-myers
All SB14 ABENDs have something to do with with updating a PDS directory, usually because the JCL specified a member name, as in DSN=dataset(member). Properly speaking, this question should be a new topic in JCL or ABENDS & SQL Codes. As Mr. Yaeger says, this new topic should include the failing JCL statement and the IEC217I message for topic responders to provide assistance. If you look up the IEC217I message in "MVS System Messages, Vol 7 (IEB-IEE)" there is a good chance you can resolve this all by your little self.

Re: Reformatting Input field in my JCL

PostPosted: Thu Mar 15, 2012 7:14 pm
by mathew28
Hi,

Thanks Steve and Frank, the issue got resolved. As steve mentioned, I had given the output file as a PDS member and that caused the abend.
When I changed the OUT from a PDS member to a simple FB 80 PS file , it worked perfectly.

Is there a way to be done for a PDS member file with the ICETOOL ? What is the option ?

Thanks

Re: Reformatting Input field in my JCL

PostPosted: Thu Mar 15, 2012 7:51 pm
by steve-myers
Mr. Yaeger and I both asked for more information, which you have not provided. A PDS member is basically the same as a sequential dataset; there is no conceptual reason for the sort product to have a problem with using a member of a PDS. Until you cough up the information we have requested no one can help you.

Re: Reformatting Input field in my JCL

PostPosted: Thu Mar 15, 2012 8:23 pm
by mathew28
sorry for not providing all the info . Here it is :

My JCL :

//jobcard
//STEP01   EXEC PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                       
//DFSMSG  DD SYSOUT=*                                       
//IN   DD DSN=XXX028.TEST.INFILE(INPUT),DISP=SHR           
//OUT  DD DSN=XXX028.TEST.OUTFILE(OUTFIL1),DISP=MOD        <-- Abend SB14 for this PDS member, No abend when DISP = SHR, but output file had only the last line.
//*OUT  DD DSN=XXX028.TEST.OUTFILE1,DISP=MOD                    <--               This is a PS file, It worked fine.
//TOOLIN DD *                                               
SUBSET FROM(IN) TO(OUT) KEEP INPUT FIRST USING(CTL1)       
SUBSET FROM(IN) TO(OUT) REMOVE INPUT FIRST LAST USING(CTL2)
SUBSET FROM(IN) TO(OUT) KEEP INPUT LAST USING(CTL3)         
//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)                     
/*     


JES Log:

ICH70001I XXX028  LAST ACCESS AT 10:39:22 ON THURSDAY, MARCH 15, 2012         
IEC217I B14-04,IGG0201Z,XXX028A,STEP01,OUT,0F05,TSOE06,XXX028.TEST.OUTFILE(OUTFIL1)
IEA995I SYMPTOM DUMP OUTPUT                                                     
SYSTEM COMPLETION CODE=B14  REASON CODE=00000004                               
 TIME=10.40.46  SEQ=55773  CPU=0000  ASID=00A6                                 
 PSW AT TIME OF ERROR  075C1000   80E00F20  ILC 2  INTC 0D                     
   NO ACTIVE MODULE FOUND                                                       
   NAME=UNKNOWN                                                                 
   DATA AT PSW  00E00F1A - 41003038  0A0DB20A  00509808                         
   AR/GR 0: 8EF4B48A/00E01124   1: 00000000/A4B14000                           
         2: 00000000/0000DDE0   3: 00000000/00E010EC                           
         4: 00000000/008B4888   5: 00000000/008B3714                           
         6: 00000000/008B36AC   7: 00000000/008B3718                           
         8: 00000000/008B36D4   9: 00000000/008B4338                           
         A: 00000000/00F9D070   B: 00000000/00E00C52                           
         C: 00000000/008B4338   D: 00000000/7E5BFA28                           
         E: 00000000/00E00C52   F: 00000000/00000004                           
 END OF SYMPTOM DUMP                                                           
IEF472I XXX028A STEP01 - COMPLETION CODE - SYSTEM=B14 USER=0000 REASON=00000004
IEF242I ALLOC. FOR XXX028A STEP01 AT ABEND           


Data Set Name . . . . : XXX028.TEST.OUTFILE

General Data
Management class . . : MGMTDFLT
Storage class . . . : TSO
Volume serial . . . : TSOE06
Device type . . . . : 3390
Data class . . . . . : **None**
Organization . . . : PO
Record format . . . : FB
Record length . . . : 80
Block size . . . . : 27920
1st extent cylinders: 6
Secondary cylinders : 6
Data set name type : PDS


The input and Output PDS files has the same parameters. Hope this information is sufficient. Thanks

Re: Reformatting Input field in my JCL

PostPosted: Thu Mar 15, 2012 8:35 pm
by Robert Sample
The B14-04 explanation in the MAC manual tells much:
Return Code Explanation

04
A duplicate name was found in the directory of a partitioned data set. The CLOSE routine attempted to add a member name to the directory using the STOW macro instruction, but a code of 4 was returned, indicating that the member already exists. Specify a different member name, or remove the old member name using the IEHPROGM utility, or specify DISP=OLD on the DD statement.

Re: Reformatting Input field in my JCL

PostPosted: Thu Mar 15, 2012 9:22 pm
by BillyBoyo
Have you checked in the JCL manual or anywhere else about specifying DISP=MOD for a PDS? PDS's "mod" themselves. I have no idea what this will do, as it has never seemed sensible to try it. I wouldn't want to test it on one of my own PDSs either. I suppose if the PDS does not exist, it will create the PDS, but then the member will get in the way, I think.

If a straight PS gets you your result, why do you feel the need to put a PDS there? A member on a PDS is like a sequential file - but the PDS itself, to which the DISPosition processing relates, is not like a sequential file.

If you are desperate to have the data in a member of a PDS, do a copy to the PDS member after you have your output file.