|
View previous topic :: View next topic
|
| Author |
Message |
sthirumalai
New User
.jpg)
Joined: 14 Aug 2007 Posts: 14 Location: Chennai
|
|
|
|
Hi
I have a requirement as explained below
There is a flat file of length 150 bytes.
In that file 1 thru 6 position is the identifier field and from 96 thru 103 is the service year field. The file is sorted on identifier ascending and service years descending.
The requirement is to find out the difference between the service years for the first & last record in a group of identifiers.
eq:
Consider the below sample of recs
IDENTIFIER
|CHR 6
|(1:6)
|2
*********** TOP OF DA
XXXX02
XXXX02
XXXX07
XXXX07
XXXX10
XXXX10
XXXX10
XXXX10
XXXX11
XXXX11
XXXX11
XXXX11
XXXX13
XXXX13
U20014
U20014
U20016
|SERVICE YEAR
|PAC 15
|(96:103)
|12
* TOP OF DATA *****
29.00
19.00
12.00
7.00
22.00
9.00
8.00
6.00
54.00
25.00
15.00
12.00
21.00
14.00
19.00
9.00
20.00
For the identifier XXXX10:
The difference should be 22 - 6 = 16
There may be n number of records in a group.
Is there any way to do this using DFsort or ICETOOL?
Regards
Santhosh |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Just few more bits of information needed on your problem,
1: for U20016(Only occurance) - Should it come in output? if yes with what value?
2: What is the version of DFSORT you have installed at your shop...
(To know read this first and reply www.ibmmainframes.com/viewtopic.php?t=33389)
3: Can you show this example with code tag facility used... |
|
| Back to top |
|
 |
sthirumalai
New User
.jpg)
Joined: 14 Aug 2007 Posts: 14 Location: Chennai
|
|
|
|
Hi Escapa,
Please find my answers below
for
#1.Yes this is a possibility. If there is only one record then the service years of that records should come in the O/P. In the case of U20016 the Service years should be 20.
#2. We use DFSORT V1R12
#3. I am not sure about code tag facility. can you explain bit more on that please?
Regards
Santhosh |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| sthirumalai wrote: |
Hi Escapa,
#2. We use DFSORT V1R12
#3. I am not sure about code tag facility. can you explain bit more on that please?
|
#2 -> No. You havnt read link I gave you properly, We want to know PTF level, post complete ICE201I message you are getting.
#3 -> I don't know how to explain this.. Cz.. This is assumed to be one of those common sense thing.. |
|
| Back to top |
|
 |
sthirumalai
New User
.jpg)
Joined: 14 Aug 2007 Posts: 14 Location: Chennai
|
|
|
|
Okay for
#2 ICE201I H RECORD TYPE.
Please let me know if you need more details |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
| Quote: |
| #3. I am not sure about code tag facility. can you explain bit more on that please? |
Notice that your question has been "Quoted". Next to the Quote Tag is the Code Tag. Highlight data you want the alignment preserved and click Code. Then click Preview to see your post as it will appear to the forum. Then Submit when it looks as you want. |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Hi,
bit turbid one, you got to spend some testing on it... I have simulated it for 80 byte record length file...
| Code: |
//S1 EXEC PGM=ICETOOL
//SYSOUT DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//IN DD *
XXXX02 29.00
XXXX02 19.00
XXXX07 12.00
XXXX07 7.00
XXXX10 22.00
XXXX10 9.00
XXXX10 8.00
XXXX10 6.00
XXXX11 54.00
XXXX11 25.00
XXXX11 15.00
XXXX11 12.00
XXXX13 21.00
XXXX13 14.00
U20014 19.00
U20014 9.00
U20016 20.00
/*
//OUT DD DSN=&&TEMP,DISP=(NEW,PASS)
//OUT1 DD SYSOUT=*
//TOOLIN DD *
SELECT ON(1,6,CH) FROM(IN) TO(OUT) LAST USING(CTL1)
COPY FROM(OUT) TO(OUT1) USING(CTL2)
//CTL1CNTL DD *
OPTION COPY,EQUALS
INREC IFTHEN=(WHEN=GROUP,
KEYBEGIN=(1,6),PUSH=(81:12,6,91:SEQ=8)),
IFTHEN=(WHEN=INIT,
OVERLAY=(12:81,6,UFF,SUB,12,6,UFF,EDIT=(IIIT.II)))
/*
//CTL2CNTL DD *
OPTION COPY,EQUALS
INREC IFTHEN=(WHEN=(91,8,ZD,EQ,1),
OVERLAY=(12:81,6,X))
OUTFIL BUILD=(1,80)
|
Output will be...
| Code: |
XXXX02 10.00
XXXX07 5.00
XXXX10 16.00
XXXX11 42.00
XXXX13 7.00
U20014 10.00
U20016 20.00
|
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a better way to do it with DFSORT using only one pass and no sorting. I assumed the Service Year was actually a 96,8,PD input field based on the description of PAC 15 (96:103).
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/150)
//SORTOUT DD DSN=... output file (FB/26)
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=26,
IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,6),PUSH=(31:96,8,41:SEQ=8)),
IFTHEN=(WHEN=(41,8,ZD,EQ,1),
BUILD=(1,6,11:31,8,PD,EDIT=(IIIIIIIIIIIIT.TT))),
IFTHEN=(WHEN=(41,8,ZD,GT,1),
BUILD=(1,6,11:31,8,PD,SUB,96,8,PD,
EDIT=(IIIIIIIIIIIIT.TT)))
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,6,
TRAILER3=(1,6,11:11,16))
/*
|
SORTOUT would have:
| Code: |
XXXX02 10.00
XXXX07 5.00
XXXX10 16.00
XXXX11 42.00
XXXX13 7.00
U20014 10.00
U20016 20.00
|
|
|
| Back to top |
|
 |
sthirumalai
New User
.jpg)
Joined: 14 Aug 2007 Posts: 14 Location: Chennai
|
|
|
|
Hi Frank/Escapa/Dick
Thanks for all your help
Frank,Your solution works 100%.
Thanks again
Regards
Santhosh |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|