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

Get Record count from multiple files using JCL


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Anubhava

New User


Joined: 31 Jan 2022
Posts: 3
Location: INDIA

PostPosted: Mon Jan 31, 2022 7:56 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2144
Location: USA

PostPosted: Mon Jan 31, 2022 8:17 pm
Reply with quote

It is not possible while "using JCL".

What have you tried so far?
Back to top
View user's profile Send private message
Anubhava

New User


Joined: 31 Jan 2022
Posts: 3
Location: INDIA

PostPosted: Tue Feb 01, 2022 12:58 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1337
Location: Bamberg, Germany

PostPosted: Tue Feb 01, 2022 4:11 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2144
Location: USA

PostPosted: Tue Feb 01, 2022 6:48 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1337
Location: Bamberg, Germany

PostPosted: Tue Feb 01, 2022 8:58 pm
Reply with quote

sergeyken wrote:
Code:
.. COUNT,ZD,LENGTH=8))  print record count

LENGTH should be 9 according to TS.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2144
Location: USA

PostPosted: Tue Feb 01, 2022 9:34 pm
Reply with quote

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 icon_lol.gif
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts 3 files concatenated to 1 DFSORT/ICETOOL 2
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
Search our Forums:

Back to Top