View previous topic :: View next topic
|
Author |
Message |
reinawar3 Warnings : 1 New User
Joined: 12 Sep 2006 Posts: 1
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|