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 SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


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