MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get the Count of records under each Sections

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
nbdtrjk_1
Beginner


Joined: 14 Jun 2021
Posts: 11
Topics: 4

PostPosted: Wed Jun 07, 2023 7:23 am    Post subject: Get the Count of records under each Sections Reply with quote

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


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Mon Jun 12, 2023 2:12 pm    Post subject: Reply with quote

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 - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nbdtrjk_1
Beginner


Joined: 14 Jun 2021
Posts: 11
Topics: 4

PostPosted: Wed Jun 14, 2023 6:35 am    Post subject: Reply with quote

Perfect. Thanks Kolusu.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group