IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How can I sum record with conditions like this ?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
reinawar3
Warnings : 1

New User


Joined: 12 Sep 2006
Posts: 1

PostPosted: Wed Mar 28, 2007 4:56 pm
Reply with quote

Please help me, I have some conditions that show in below this sentence.

My input data has 2 fields
01 TEST001-REC.
??05 TEST001-ACCT ??PIC S9(10) COMP-3.
??05 TEST001-AMOUNT ??PIC S9(13)V99 COMP-3.

Example records
TEST001-ACCT ? TEST001-AMOUNT
0011222222 ??? 200.00
0011222223 ??? 200.00
0012111111 ??? 500.00
0021123456 ??? 100.00

It impossible to use only JCL to generate output with conditions
- Sum records when first 4 digits are same.
- Sum amount of items.

Output look like this.

01 TEST002-REC.
?? 05 TEST002-BRANCH ??PIC S9(04) COMP-3.
?? 05 TEST002-AMOUNT ??PIC S9(13)V99 COMP-3.
?? 05 TEST002-ITEMS ??PIC 9(05).

TEST002-BRANCH ?????TEST002-AMOUNT ????? TEST002-ITEMS
0011 ????? 400.00 ???? 2
0012 ????? 500.00 ???? 1
0021 ????? 100.00 ???? 1

Thank you very much.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Mar 28, 2007 9:00 pm
Reply with quote

This is a bit tricky because you want to sort and extract part of a PD field, but here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/14)
//SORTOUT DD DSN=...  output file (FB/16)
//SYSIN    DD    *
  INREC OVERLAY=(16:C'00001')
  SORT FIELDS=(1,3,PD0,A)
  SUM FIELDS=(7,8,PD,16,5,ZD)
  OUTREC BUILD=(1,3,PD0,TO=PD,LENGTH=3,
    4:7,8,12:16,5,ZD,M10,LENGTH=5)
/*
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Mar 29, 2007 9:13 am
Reply with quote

Frank,

Could you explain what PDO stands for? By going through control card and the original post, I understood we are considering a part of PD.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Mar 29, 2007 8:22 pm
Reply with quote

PD0 (zero, not oh) is packed decimal, with first digit and sign ignored.

So for your 6-byte PD value (in hex) of:

00011222222C

1,3,PD0 works with 000112 and treats it as x0011x where x is ignored.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts How to load to DB2 with column level ... DB2 6
Search our Forums:

Back to Top