|
View previous topic :: View next topic
|
| Author |
Message |
hiravibk Warnings : 1 Active User
Joined: 14 Dec 2008 Posts: 107 Location: India
|
|
|
|
Hi,
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. |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
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?
What is the LRECL and RECFM of the input file?
Thanks, |
|
| Back to top |
|
 |
hiravibk Warnings : 1 Active User
Joined: 14 Dec 2008 Posts: 107 Location: India
|
|
|
|
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. |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
hiravibk,
| Quote: |
| 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.
| Code: |
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAAAAAAAA Y.....092310
BBBBBBBBBB2010/09/23 T.....092310
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=(34,1,CH,NE,C'Y'),
OVERLAY=(15:16,2,19,2,2X))
SORT FIELDS=COPY
//* |
OUTPUT
| Code: |
AAAAAAAAAA Y.....092310
BBBBBBBBBB20100923 T.....092310 |
Thanks, |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
hiravibk,
| Quote: |
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.
|
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. |
|
| Back to top |
|
 |
hiravibk Warnings : 1 Active User
Joined: 14 Dec 2008 Posts: 107 Location: India
|
|
|
|
Hi,
Thank you for your response. I think i didnt mention clearly about one part. below is the file layout, rules and requirements:
1234567890123456789012345678901234
AAAAAAAAAA.......................Y.....092310
BBBBBBBBBB2010/09/23....T.....092310
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. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Again:
What is the LRECL and RECFM of the input file?
Please show a better example (or examples) with all input variations of interest and the expected output for each.
Is the 123... line actually part of the input file? If not, don't show it. Show multiple Y and T lines if they can be present. |
|
| Back to top |
|
 |
hiravibk Warnings : 1 Active User
Joined: 14 Dec 2008 Posts: 107 Location: India
|
|
|
|
Hi Frank,
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.
Example1:
$ indicates a blank space
Input file:
DDDDDDDDDD
AAAAAAAAAA$$$$$$$$$$$Y$$042610$$$$$$$$$$
BBBBBBBBBB2010/09/23$T$$061810$$$$$$$$$
FFFFFFFFFF2011/05/20$T$071410$$$$$$$$$$
Output file:
AAAAAAAAAA$$$$$$$$$$$Y$$20100426$$$$$$$$
BBBBBBBBBB20100923$$$T$$20100618$$$$$$$$
FFFFFFFFFF20110520$$$T$$20100714$$$$$$$$ |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
hiravibk,
See if this works for you... You can adjust Y2PAST value to adjust century values for your input records.
| Code: |
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
DDDDDDDDDD
AAAAAAAAAA Y 042610
BBBBBBBBBB2010/09/23 T 061810
FFFFFFFFFF2011/05/20 T 071410
GGGGGGGGGG2009/12/20 T 071499
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION SKIPREC=1,Y2PAST=1980
INREC IFTHEN=(WHEN=INIT,BUILD=(1,24,25,6,Y2W,TOGREG=Y4T,33,7)),
IFTHEN=(WHEN=(22,01,CH,NE,C'Y'),OVERLAY=(15:16,2,19,2,2X))
SORT FIELDS=COPY
//* |
| Code: |
AAAAAAAAAA Y 20100426
BBBBBBBBBB20100923 T 20100618
FFFFFFFFFF20110520 T 20100714
GGGGGGGGGG20091220 T 19990714 |
Thanks, |
|
| Back to top |
|
 |
hiravibk Warnings : 1 Active User
Joined: 14 Dec 2008 Posts: 107 Location: India
|
|
|
|
Hi sqlcode1,
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
| Code: |
[code] your code
goes in here [/code] |
|
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
hiravibk,
This may or may not be efficient or appropriate way to code but see if below works. This mimics century window of Y2PAST=1980
| Code: |
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
DDDDDDDDDD
AAAAAAAAAA Y 042680
BBBBBBBBBB2010/09/23 T 061810
FFFFFFFFFF2011/05/20 T 071410
GGGGGGGGGG2009/12/20 T 071499
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION SKIPREC=1
INREC IFTHEN=(WHEN=(29,02,ZD,LT,+80),
BUILD=(01,24,C'20',29,02,25,04,33,07)),
IFTHEN=(WHEN=(29,02,ZD,GE,+80),
BUILD=(01,24,C'19',29,02,25,04,33,07)),
IFTHEN=(WHEN=(22,01,CH,NE,C'Y'),OVERLAY=(15:16,2,19,2,2X))
SORT FIELDS=COPY
//* |
OUTPUT
| Code: |
AAAAAAAAAA Y 19800426
BBBBBBBBBB2010/09/23 T 20100618
FFFFFFFFFF2011/05/20 T 20100714
GGGGGGGGGG2009/12/20 T 19990714 |
Thanks, |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
I am assuming that DFSORT i am using(V1R10) is not the latest.
|
You need z/OS DFSORT V1R10 PTF UK51707 (November, 2009) to use TOGREG. Ask your System Programmer to install that PTF (it's free). |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|