Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Difference of values between first & last record in a gr

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sthirumalai

New User


Joined: 14 Aug 2007
Posts: 14
Location: Chennai

PostPosted: Wed Jul 06, 2011 8:46 pm    Post subject: Difference of values between first & last record in a gr
Reply with quote

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
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Jul 06, 2011 9:06 pm    Post subject:
Reply with quote

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 http://www.ibmmainframes.com/viewtopic.php?t=33389)

3: Can you show this example with code tag facility used...
Back to top
View user's profile Send private message
sthirumalai

New User


Joined: 14 Aug 2007
Posts: 14
Location: Chennai

PostPosted: Wed Jul 06, 2011 9:12 pm    Post subject: Reply to: Difference of values between first & last reco
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Jul 06, 2011 9:16 pm    Post subject: Re: Reply to: Difference of values between first & last
Reply with quote

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
View user's profile Send private message
sthirumalai

New User


Joined: 14 Aug 2007
Posts: 14
Location: Chennai

PostPosted: Wed Jul 06, 2011 9:22 pm    Post subject: Reply to: Difference of values between first & last reco
Reply with quote

Okay for

#2 ICE201I H RECORD TYPE.

Please let me know if you need more details
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jul 06, 2011 10:02 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Jul 06, 2011 10:13 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jul 07, 2011 3:30 am    Post subject:
Reply with quote

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
View user's profile Send private message
sthirumalai

New User


Joined: 14 Aug 2007
Posts: 14
Location: Chennai

PostPosted: Fri Jul 08, 2011 2:01 am    Post subject: Reply to: Difference of values between first & last reco
Reply with quote

Hi Frank/Escapa/Dick

Thanks for all your help

Frank,Your solution works 100%.

Thanks again

Regards
Santhosh
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 1 Tue Jul 25, 2017 12:12 am
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us