Processing the ID section of SMF type-30

Document ID : KB000047689
Last Modified Date : 14/02/2018
Show Technical Document Details

Introduction:

processing the ID section of SMF type-30 

Question:

I have an issue processing the ID section of SMF type-30 records that can start at different offsets into the records based on the version of the operating system that produced the records. Ex: for one version, the ID section of 100 bytes of the record starts 211 bytes into the record, and for another version the ID section starts at 227 bytes into the record. Where the ID section starts is in a field in the header section of each record (an offset value is provided for the starting point of the data). Is there a way to easily code for this using easytrieve? 

I'd like to be able to do something like move 100 bytes of data starting at offset 'x' into the record, where 'x' is provided in the header value of the same record. I know I could do this with subscripting, but there are potentially hundreds of thousands of records to process daily and moving a byte at a time with a loop doesn't sound very efficient. If we could code something equivalent to "Move FIELD1:100 starting byte 'x'" that would work for us.

Environment: 

Executing an Easytrieve program, and creating SMF type-30 records. 

Answer: 

 Easytrieve only lets you define a field once at compile time and does not allow that to be a "fluid" definition during runtime based upon the data. The location and length are locked at compile time so the proper memory allocation can be made during runtime. 

Since you are working with SMF records, I will use that as a specific example. The SMF record is a varying record that can be up to 32756 bytes. So I defined that as: 

SMF_Record 1 32756 A VARYING 
RecPart SMF_Record 1 A INDEX Rec_Index OCCURS 32756 

Of, course, all of the Common Address Space field definitions follow that. I then define the ID section like this: 

SMF30ID W 184 A 
IdPart SMF30ID 1 A INDEX SMF30ID_INDEX OCCURS 184 
SMF30JBN SMF30ID 8 A HEADING('Job' 'Name') 
SMF30PGM SMF30ID +8 8 A HEADING('Program' 'Name') 
SMF30STM SMF30ID +16 8 A HEADING('Step' 'Name') 
SMF30JNM SMF30ID +32 8 A HEADING('JES' 'Identifier') 
SMF30STN SMF30ID +40 2 B HEADING('Step' 'Number') 
SMF30USR SMF30ID +80 20 A HEADING('Programmers' 'Name') 
SMF30EXT SMF30ID +168 16 A 

Notice that it becomes just a working storage field and is sub-divided into the IdPart field so I can access the individual bytes.