Posted: Mon May 27, 2024 2:36 am Post subject: Need help in formatting output
I have a dataset with data as below FB 80 bytes 800 BLKSIZE
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
SYSDSNAME=TEST.DBDSRC
SYSADIRBLK=1848
SYSALLOC=210
SYSUDIRBLK=1752
SYSUSED=104
SYSMEMBERS=12259
SYSEXTENTS=16
SYSCREATE=1995/071
SYSPRIMARY=135
SYSUNITS=CYLINDER
I need desired output as below
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
TEST.DBDSRC 2024-05-27
ALLOCATED DIRECTORY BLOCKS: 1848
USED DIRECTORY BLOCKS: 1752
LEFT OUT DIRECTORY BLOCKS: 96
CURRENT NUMBER OF MEMBERS : 12259
YOU CAN ACCMODATE MEMBERS : 576 ( 96 * 6 = 576 )
ALLOCATED SPACE : 210
USED SPACE : 104
LEFT OUT SPACE : 106 CYLINDERS - this should pick up from the variable output SYSUNITS
EXTENTS : 1
I have not used SORT for a long time and I would need help. I started with the below code and I got
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
TEST.DBDSRC 2024-05-27
ALLOCATED DIRECTORY BLOCKS: 1848
USED DIRECTORY BLOCKS: 1752
LEFT OUT DIRECTORY BLOCKS:
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Mon May 27, 2024 9:46 am Post subject:
shekar123,
What a waste of time and resources. A simple 10 line report can be generated much faster by hand rather than running 6 passes of data for getting only partial data
You have been a member for a long time, but post questions which lack BASIC information like what is the LRECL and RECFM of the input file? I had to find out from your sample coded JCL. On top of it you post incorrect output.
in your input you have
Code:
SYSEXTENTS=16
but your output you have
Code:
EXTENTS : 1
Where did you get the extents of 1 when the value is 16?
Any way here is a UNTESTED 1 step solution that would give you the desired results.
Thank you so much for your help. I lost DFSORT usage to some extent. I completely agree whatever I coded is just waste of time and resources.But I have completely understand the code syntax and the way you have achieved the output.
Code:
TEST.DBDSRC 2024-05-27
ALLOCATED DIRECTORY BLOCKS : 1848
USED DIRECTORY BLOCKS : 1752
LEFT OUT DIRECTORY BLOCKS : 96
CURRENT NUMBER OF MEMBERS : 12259
YOU CAN ACCMODATE MEMBERS : 576
ALLOCATED SPACE : 210
USED SPACE : 104
LEFT OUT SPACE : 106 CYLINDER
EXTENTS : 16
Thank you once again. _________________ Shekar
Grow Technically
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Mon May 27, 2024 6:45 pm Post subject:
shekar123 wrote:
I lost DFSORT usage to some extent.
shekar123,
Any programming language/utility is like riding a bike. You learn once and never forget. I haven't coded COBOL programs since 2006 as I primarily deal with HLASM, but even to this date, I can code an entire COBOL program on the fly. Same with Db2. So pay attention to what you learn and that helps in the long run.
shekar123 wrote:
But I have completely understand the code syntax and the way you have achieved the output.
The job is quite simple.
1. The INCLUDE COND will only bring in the desired records.
2. We parse the contents of each record looking "=" and pick the contents after that. Since the dataset name can be a maximum of 44 bytes, we used FIXLEN=44
3. We also need to re-arrange the records as the output you want is NOT following the same order as the input. So we tag every record as "Z" and then change it based it on fields
4. Now sort the records so that they are in the order that you seek.
5. On outrec using when=GROUP, you just need to push the values on to each record, so that all the records have information you require.
6. Now since you needed the calculation allocated - used and primary - secondary we do that calculation
7. Once we have we the necessary information, it is just about building the final output. The "/" is used to create a new record.
If you do want to understand how each of the statements work, you can run the job with 1 statement at a time
Thanks a lot a lot and a lot. Again you have taken a lot of time in explaining each step in so detail. Great of you. This helps a lot. _________________ Shekar
Grow Technically
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