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
 

 

How can I sum record with conditions like this ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How can I sum record with conditions like this ?
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 Moderator


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

PostPosted: Wed Mar 28, 2007 9:00 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Thu Mar 29, 2007 9:13 am    Post subject:
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 Moderator


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

PostPosted: Thu Mar 29, 2007 8:22 pm    Post subject:
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    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 Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 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 Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


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