View previous topic :: View next topic
|
Author |
Message |
Anubhava
New User
Joined: 31 Jan 2022 Posts: 3 Location: INDIA
|
|
|
|
Hi! I have the following requirement:
input file1:
123456789-123456789-123456789-123456789-123456789-----> column
A T1234567 01/10
B T1234561 01/10
A T1234562 01/10
B T1234563 01/10
A T1234564 01/10
B T1234565 01/10
A T1234566 01/10
A T1234567 01/10
input file2:
123456789-123456789-123456789-123456789-123456789-----> column
A T1234567 01/11
A T1234561 01/11
A T1234562 01/11
B T1234563 01/11
A T1234564 01/11
B T1234565 01/11
A T1234566 01/11
A T1234567 01/11
Total 10 input files in the same format as above - the date will remain the same for all records in a file, but differ from file to file as given in the example
All files are FB, Sequential files. Files could have 1000s of records.
In my output file i need the Date and Total Number of records in each input file, only records marked as A at pos 1 need to be considered in the Total.
output:
01/10 000000005
01/11 000000006 |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2022 Location: USA
|
|
|
|
It is not possible while "using JCL".
What have you tried so far? |
|
Back to top |
|
|
Anubhava
New User
Joined: 31 Jan 2022 Posts: 3 Location: INDIA
|
|
|
|
This is what I have tried, but not able to do it without the 'A' in the output.
//SORT1 EXEC PGM=SORT
//SORTIN DD DSN=INPUT1,DISP=SHR
// DD DSN=INPUT2,DISP=SHR
//SORTOUT DD DSN=OUTPUT1,DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(3,5,CH,A)
INREC FIELDS=(1:1,1,3:12,5,9:C'000000001') - - - > formats as A 01/11 000000001
SUM FIELDS=(9,9,ZD)
INCLUDE COND=(1,1,CH,EQ,C'A')
/*
OUTPUT1:
A 01/10 000000005
A 01/11 000000006 |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1255 Location: Bamberg, Germany
|
|
|
|
Use code tags please. It has been discussed Ad Nauseam in the forum.
Add OUTREC BUILD=(<fields in question>) and you are done. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2022 Location: USA
|
|
|
|
Code: |
INCLUDE COND=(1,1,CH,EQ,C'A') - filter-out unneeded rows on entry
SORT FIELDS=(12,5,CH,A) - resort on date value, to be sure
OUTFIL REMOVECC,NODETAIL, - eliminate all input records from output
SECTIONS=(12,5, - on each date change:
TRAILER3=(1,1,X, insert one "report line" for the same date
12,5,X, for the specific date
COUNT,ZD,LENGTH=8)) print record count
|
Please note: this is not JCL solution!
OUTPUT1:
Code: |
A 01/10 000000005
A 01/11 000000006 |
|
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1255 Location: Bamberg, Germany
|
|
|
|
sergeyken wrote: |
Code: |
.. COUNT,ZD,LENGTH=8)) print record count
|
|
LENGTH should be 9 according to TS. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2022 Location: USA
|
|
|
|
Joerg.Findeisen wrote: |
sergeyken wrote: |
Code: |
.. COUNT,ZD,LENGTH=8)) print record count
|
|
LENGTH should be 9 according to TS. |
TS wrote: |
Files could have 1000s of records. |
If so, LENGTH=5 should be enough |
|
Back to top |
|
|
|