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
 

 

Adding a field in TRAILER based on another field.

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

New User


Joined: 27 Jun 2005
Posts: 36
Location: India

PostPosted: Fri Jan 25, 2008 1:59 am    Post subject: Adding a field in TRAILER based on another field.
Reply with quote

Hi All,
After a long time I am back to mainframe again.. :)
I got a requirement recently which I don’t know how to do that through sort parm. So need your help.
Here is the detail of the requirement:
1. We are matching two files based on a key, in a program and giving an o/p file which has the fields--> Key, Amount and the Indicator(Matched & Unmatched).
2. In the next step we are using Report Sort parm to generate a report. The requirements of that report are:
a. The TRAILER should have a Total field having the sum of all the amount for that key and an UNMATCHED Total field which should have the sum amount of unmatched records for that key.

Please advice if there are way to do this.
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: Fri Jan 25, 2008 2:12 am    Post subject:
Reply with quote

Welcome back icon_smile.gif

Please post the lrecl and recfm of the files.

Also, please post some sample input data and the otput you need when that input is processed. Show the field positions in the inputs and the output(s).
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: Fri Jan 25, 2008 2:14 am    Post subject:
Reply with quote

Quote:
Please advice if there are way to do this.


I'm sure there's a way to do this with DFSORT, but in order to tell you how to do it I need you to give me more information for step 2 as follows:

(When I refer to "input file" below, I mean the output file from step 1 with the Key, Amount and the Indicator(Matched & Unmatched) which is the input file for step 2.)

What is the RECFM and LRECL of the input file?

What is the starting position, length and format of the following fields in the input file: Key, Amount, Indicator?

Please show an example of the record in the input file (relevant fields only) and what you expect the output to look like.
Back to top
View user's profile Send private message
Hritam

New User


Joined: 27 Jun 2005
Posts: 36
Location: India

PostPosted: Fri Jan 25, 2008 3:02 am    Post subject:
Reply with quote

Thanks!

Here are the details you asked for:
I/P
===========
LRECL = 79
RECFM = FB

UM --> Unmatched indicator
M --> Matched Indicator

I/p and o/p record structure are attached.

I took lots of time to edit that notepad, so please find and respond.

Thanks,
Back to top
View user's profile Send private message
Hritam

New User


Joined: 27 Jun 2005
Posts: 36
Location: India

PostPosted: Fri Jan 25, 2008 3:04 am    Post subject:
Reply with quote

Yes Frank, STEP2 Input is the O/p file of STEP1...
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: Fri Jan 25, 2008 4:54 am    Post subject:
Reply with quote

Well, your totals don't really seem to add up to what's in your data, but I think I get the idea. You can use a DFSORT job like the following. Just adjust everything for your actual input fields and expected output. The trick is to use IFTHEN to put 16-23 in 80-87 for the 'UM' records and PD 0's in 80-87 for the other records, and then do a TOT on 80-87 to get the total for the 'UM' records.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/79)
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/79)
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=INIT,
     OVERLAY=(80:+0,TO=PD,LENGTH=8)),
    IFTHEN=(WHEN=(78,2,CH,EQ,C'UM'),OVERLAY=(80:16,8))
  SORT FIELDS=(1,15,CH,A)
  OUTFIL BUILD=(33,14,45:16,8,PD,EDIT=(IIIT.TTTT)),
    SECTIONS=(1,15,
      HEADER3=(/,'header stuff'),
      TRAILER3=(/,'UNMATCHED TOTAL',
        45:TOT=(80,8,PD,EDIT=(IIIT.TTTT)),/,
       11:'TOTAL',
        45:TOT=(16,8,PD,EDIT=(IIIT.TTTT))))
/*
Back to top
View user's profile Send private message
Hritam

New User


Joined: 27 Jun 2005
Posts: 36
Location: India

PostPosted: Wed Jan 30, 2008 2:56 am    Post subject:
Reply with quote

Thanks Frank!
Sorry for this delay in response.
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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm


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