MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
nbdtrjk_1 Beginner Joined: 14 Jun 2021 Posts: 11 Topics: 4
Posted: Wed Jun 07, 2023 7:23 am Post subject: Get the Count of records under each Sections
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)))
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Mon Jun 12, 2023 2:12 pm Post subject:
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)))
/*
_________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
nbdtrjk_1 Beginner Joined: 14 Jun 2021 Posts: 11 Topics: 4
Posted: Wed Jun 14, 2023 6:35 am Post subject:
Perfect. Thanks Kolusu.
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum