|
View previous topic :: View next topic
|
| Author |
Message |
harithaganna
New User
Joined: 03 Jun 2008 Posts: 14 Location: chennai
|
|
|
|
I have the following requirements.
Input file has
| Code: |
C/D indicator Amount
C 100
C 200
D 300
D 400
|
I should get the below result in output file (total of all credit records and debit records in the input file)
300 700
this I can acquire by the below sortcards and splice
sort exec pgm=icetool
toolin dd dsn=&splicecardlib,disp=shr
sortin dd dsn=&input file,disp=shr
temp dd dsn=&&tmpfile,disp=(mod,pass),
unit=sysda,space=(trk,(20,20),rlse)
sortout dd dsn=&outfile,
ctl1cntl dd dsn=&cardlib1,disp=shr
ctl2cntl dd dsn=&cardlib2,disp=shr
CARDLIB1:
INCLUDE COND=(1,01,CH,EQ,C'C')
SORT FIELDS=(1,01,CH,A)
SUM FIELDS=(2,3,ZD)
OUTREC BUILD=(1:2,3,ZD,TO=ZD,LENGTH=5,
6:99X,
100:C'1')
CARDLIB2:
INCLUDE COND=(1,01,CH,EQ,C'D')
SORT FIELDS=(1,01,CH,A)
SUM FIELDS=(2,3,ZD)
OUTREC BUILD=(1:2,3,ZD,TO=ZD,LENGTH=5,
6:99X,
100:C'1')
splice cardlib:
sort from(input) to (temp) using ctl1
sort from(input) to (temp) using ctl2
splice from(temp) -
to (output) -
on(100,1,zd) -
with(1,3)
But the same logic is not working if the input file has same set of records(either debit or credit) the output file is empty for the above condition.
the temp file is only has 1 record for one set of records (either credit or debit) It's not finding the other record to compare with the unique indicator in 100th position and write it to outfile as one record.
regards
haritha |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
It's not clear what you're trying to do. Showing us what you did that didn't work without explaining what you're trying to do makes it difficult to help you.
Please start over and show examples of the input records and expected output for various cases (including the one that doesn't work with your job). Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input file. Give the starting position, length and format of each relevant field. |
|
| Back to top |
|
 |
harithaganna
New User
Joined: 03 Jun 2008 Posts: 14 Location: chennai
|
|
|
|
I want your help for the below issue
i am having the input file with credit/debit indicator and amount.
LRECL is 80
file layout is given below
01 C/D indicator pic x(01)
01 Amount pic s9(3)v99
Now whatever i have explained above is working fine,if the input file is having both credit and debit records.
If the input file is having only credit or only debit records(one sided records),The amount is summing up for either credit or debit.But the other amount is getting displayed as spaces.
for example
If input file contains
C 100
C 200
The output file is getting only
300 spaces(DB amount)
as per the above code but i should not get these spaces. instead of these spaces i should move 000 amount to the db amount if no debit records found in the input file viceversa for credit amount also.
Thanks & regards
haritha |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I can't fix your job because it doesn't make any sense.
However, you can use a DFSORT job like the following to do what I think you're asking for:
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
C00100
C00200
D00300
D00400
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=(1,1,CH,EQ,C'C'),BUILD=(1:2,5,11:C'00000')),
IFTHEN=(WHEN=(1,1,CH,EQ,C'D'),BUILD=(1:C'00000',11:2,5))
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(TOT=(1,5,ZD,EDIT=(TTTTT)),
11:TOT=(11,5,ZD,EDIT=(TTTTT)))
/*
|
For that input, SORTOUT will have:
With just the C records for input, SORTOUT will have:
With just the D records for input, SORTOUT will have:
If that's not what you want, then you need to do a better job of explaining what you do want with good examples of input and expected output. |
|
| Back to top |
|
 |
harithaganna
New User
Joined: 03 Jun 2008 Posts: 14 Location: chennai
|
|
|
|
Thank you soo much
The logic worked for me.
Thanks & regards
Haritha |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|