Get the Count of records under each Sections
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Utilities

#1: Get the Count of records under each Sections Author: nbdtrjk_1 PostPosted: Wed Jun 07, 2023 7:23 am
    —
All

I have a requirement to get record counts under each sections.

Input(FB,80 Bytes)
Code:

FILE:ABC.XYZ1
MEM1
MEM2
MEM3
MEM4
FILE:ABC.XYZ2
MEM1
MEM2
MEM3
FILE:ABC.XYZ3
FILE:ABC.XYZ4
MEM3


Output:
Code:

FILE:ABC.XYZ1
MEM1
MEM2
MEM3
MEM6
Count:0004
FILE:ABC.XYZ2
MEM1
MEM2
MEM3
Count:0003
FILE:ABC.XYZ3
Count:0000
FILE:ABC.XYZ4
MEM3
Count:0001


I tried using below code but not getting the exact requirement. please advise

Sysin DD *
OPTION COPY
OUTFIL REMOVECC,SECTIONS=(1,40,
TRAILER3=(COUNT=(M11,LENGTH=4)))

#2:  Author: kolusuLocation: San Jose PostPosted: Mon Jun 12, 2023 2:12 pm
    —
nbdtrjk_1,

Use the following DFSORT JCL which will give you the desired results. I assumed that the input has LRECL=80 and RECFM=FB
Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
FILE:ABC.XYZ1                                           
MEM1                                                     
MEM2                                                     
MEM3                                                     
MEM4                                                     
FILE:ABC.XYZ2                                           
MEM1                                                     
MEM2                                                     
MEM3                                                     
FILE:ABC.XYZ3                                           
FILE:ABC.XYZ4                                           
MEM3                                                     
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  OPTION COPY                                           
  INREC IFTHEN=(WHEN=GROUP,                             
               BEGIN=(01,05,CH,EQ,C'FILE:'),             
                PUSH=(81:ID=8))                         
                                                         
  OUTFIL REMOVECC,                                       
  BUILD=(01,80),                                         
  SECTIONS=(81,08,                                       
  TRAILER3=('COUNTS:',COUNT-1=(M11,LENGTH=4)))           
/*                                                       

#3:  Author: nbdtrjk_1 PostPosted: Wed Jun 14, 2023 6:35 am
    —
Perfect. Thanks Kolusu.



MVSFORUMS.com -> Utilities


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group