I have two kinds of records in a file:
AAAAAAAAAA.......................Y.....092310
BBBBBBBBBB2010/09/23.....T.....092310
I need to skip the first record in the file. And I need to convert the date formats in the file from the second record to YYYYMMDD format. Is this possible in ICETOOL/DFSORT. Any help is greatly appreciated.
Note: There will be no date in position 11 if there is a 'Y' in position 33.
hiravibk,
Your input date is 10 bytes, and after conversion it becomes 8 bytes. Do you want to shift remaining bytes to the left after conversion?
Is it safe to assume that whenever there is Non 'Y' (i.e. A,B,T etc..) value at 11th position, you want to convert date present at 11th byte position? Or conversion should be done for T type records only?
After the date immediately, i need to give 2 blank spaces. If there is no 'Y' at position 20, then there will not be date present at position 11, it will be spaces.
Also, i need to convert all the dates 092310 present in each record at position 30.
If there is no 'Y' at position 20, then there will not be date present at position 11, it will be spaces.
How do you explain this? You show date present when there is NO 'Y' (i.e. 'T' present)
Since you haven't clearly explained the rules or atleast I can't understand..here is a vague idea to try. Remember, if you explain the rules better, you may be able to use date conversion functions supported by DFSort.
Below JCL assumes that Date is present whenever there is Non 'Y' char. present at 34th position. You may change this to suit your requirement.
I need to skip the first record in the file. And I need to convert the date formats in the file from the second record to YYYYMMDD format. Is this possible in ICETOOL/DFSORT. Any help is greatly appreciated.
Note: There will be no date in position 11 if there is a 'Y' in position 33.
Do you only have two records in the file? Or can there be more?
You say you want to skip the first record - is that the 'Y' record?
Do you want to convert both dates in the second record or in all records without Y or what?
Quote:
Also, i need to convert all the dates 092310 present in each record at position 30.
This conflicts with your example which only has two records considering that you say you want to skip the first record. Do you want to convert the date in the first record? Do you have more than two records?
Please show a better example (or examples) with all input variations of interest and the expected output for each. Give a better explanation of the complete "rules" for getting from input to output.
Rules:
- The first record in the file is a dummy record which should not be considered.
- All records have a date starting at 26th position. This date is in MMDDYY format.
- Only records having a 'Y' at 22nd position have a date in position 11 also.
This date is in YYYY/MM/DD format.
Requirements:
- The first record must be omitted.
- For records having a 'Y' in position 22, the date present in position 11 must be changed from YYYY/MM/DD format to YYYYMMDD format. So, the 10 character date becomes an 8 character date. To compensate this two blank spaces must follow after the date conversion.
- The date in position 26, must be changed from MMDDYY format to YYYYMMDD format. This is for all records.
Apologies for any confusion created previously.
Thank you.
The line 123 is just to show the position of the variables. The LRECL of the file is 40 and file is FB.Here is an example with the output I am expecting.
Thank you for your response. I just changed the position according to my requirement and executed the job. It abending with the below message. It doesnt look like the key word TOGREG is recognized. I am assuming that DFSORT i am using(V1R10) is not the latest.
Code:
1ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 02:18 ON FRI S
0 OPTION SKIPREC=1,Y2PAST=1980
INREC IFTHEN=(WHEN=INIT,BUILD=(1,80,81,6,Y2W,TOGREG=Y4T,33,7)),
$
ICE006A 0 OPERAND DEFINER ERROR
IFTHEN=(WHEN=(77,01,CH,NE,C'A'),OVERLAY=(15:16,2,19,2,2X))
$
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
SORT FIELDS=COPY
ICE751I 0 C5-K90014 C6-K90014 C7-K45047 C8-K42136 E7-K44564
ICE052I 3 END OF DFSORT
Please learn to post code and output using the code tags as shown here