IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort SMF records?


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
AlexSalas95

New User


Joined: 18 Mar 2024
Posts: 21
Location: United States

PostPosted: Thu Jan 01, 2026 12:27 am
Reply with quote

I've been tasked to split a daily SMF type 208 record dump into datasets, by system. I'm trying to do this via syncsort (coincidentally, 208 records are SyncSort SMF records but that's irrelevant), however, I can't quite figure out how to do so.

This is an example of the sort job I'm currently working on;
Code:
//STEP001  EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=<HLQ>.SEQ.DAILY.SMF208.DUMP,DISP=SHR
//SORTOF01 DD DSN=<HLQ>.SEQ.SMF208.SYSA,
//            DISP=(NEW,CATLG),
//            SPACE=(CYL,(10,10),RLSE),UNIT=DISK,
//            DCB=(LRECL=5000,RECFM=VB)
//SORTOF02 DD DSN=<HLQ>.SEQ.SMF208.SYSB,
//            DISP=(NEW,CATLG),
//            SPACE=(CYL,(10,10),RLSE),UNIT=DISK,
//            DCB=(LRECL=5000,RECFM=VB)
//SORTOF03 DD DSN=<HLQ>.SEQ.SMF208.SYSC,
//            DISP=(NEW,CATLG),
//            SPACE=(CYL,(10,10),RLSE),UNIT=DISK,
//            DCB=(LRECL=5000,RECFM=VB)
//SYSIN    DD *
 SORT FIELDS=COPY
      OUTFIL FILES=01,INCLUDE=(14,4,CH,EQ,C'SYSA')
      OUTFIL FILES=02,INCLUDE=(14,4,CH,EQ,C'SYSB')
      OUTFIL FILES=03,INCLUDE=(14,4,CH,EQ,C'SYSC')
/*
//


And for reference, this is the beginning layout of an SMF type 208 record;
Code:
SMF208LEN LEN(2) TYPE(BIN) DISP(0)           /*RECORD LENGTH*/
SMF208SEG LEN(2) TYPE(BIN) DISP(2)           /*SEGMENT DESCRIPTOR*/
SMF208FLG LEN(1) TYPE(BIN) DISP(4)           /*SYSTEM FLAGS*/
SMF208RTY LEN(1) TYPE(BU) DISP(5)            /*RECORD TYPE*/
SMF208TME LEN(4) TYPE(B-SECS) DISP(6) DEC(2) /*TIME RECORD WRITTEN TO SMF BUFFER*/
SMF208DTE TYPE(P-CYYDDD) DISP(10)            /*DATE RECORD WRITTEN TO SMF BUFFER*/
SMF208SID LEN(4) DISP(14)                    /*SYSTEM ID*/


And this is an example of a couple records when browsed via ISPF;

Code:
=COLS> ----+----1----
000001 ....Z....¬SYSA
000002 ....Ìp...|SYSA


When I run this, the job finishes without issue, however the output datasets are empty.

I could use the IFASMFDP utility, however as far as I'm aware, it cannot split out to multiple datasets by system id (i.e. only one SID can be specified, if any). In order to use IFASMFDP, I would have to have a separate step for every single LPAR. This seems very inefficient, redundant and some that should be easily perform via a sort utility.

Can sort do this? If so, how might I modify my sort card to do so properly?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1436
Location: Bamberg, Germany

PostPosted: Thu Jan 01, 2026 9:06 am
Reply with quote

It seems to me the offset is wrong. Instead of position 14, try 15.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2275
Location: USA

PostPosted: Fri Jan 02, 2026 6:48 pm
Reply with quote

AlexSalas95 wrote:

And for reference, this is the beginning layout of an SMF type 208 record;
Code:
SMF208LEN LEN(2) TYPE(BIN) DISP(0)           /*RECORD LENGTH*/
SMF208SEG LEN(2) TYPE(BIN) DISP(2)           /*SEGMENT DESCRIPTOR*/
SMF208FLG LEN(1) TYPE(BIN) DISP(4)           /*SYSTEM FLAGS*/
SMF208RTY LEN(1) TYPE(BU) DISP(5)            /*RECORD TYPE*/
SMF208TME LEN(4) TYPE(B-SECS) DISP(6) DEC(2) /*TIME RECORD WRITTEN TO SMF BUFFER*/
SMF208DTE TYPE(P-CYYDDD) DISP(10)            /*DATE RECORD WRITTEN TO SMF BUFFER*/
SMF208SID LEN(4) DISP(14)                    /*SYSTEM ID*/


And this is an example of a couple records when browsed via ISPF;

Code:
=COLS> ----+----1----
000001 ....Z....¬SYSA
000002 ....Ìp...|SYSA

As shown above, the displacement in your printed example starts with 0, while SORT counts all its displacements starting from 1.

If so, your selection must be
Code:
 INCLUDE=(15,4, ...


P.S.
You might easily discover this by yourself, just using
Code:
 OUTFIL FNAMES=TESTFILE,BUILD=(1,4,C'TEST FIELD=',14,4)
Back to top
View user's profile Send private message
AlexSalas95

New User


Joined: 18 Mar 2024
Posts: 21
Location: United States

PostPosted: Sat Jan 03, 2026 1:59 am
Reply with quote

well, that's embarrassing. I changed the offset to 15 and I'm getting records now

Thanks @Joerg.Findeisen & @sergeyken
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2275
Location: USA

PostPosted: Sat Jan 03, 2026 2:18 am
Reply with quote

AlexSalas95 wrote:
well, that's embarrassing. I changed the offset to 15 and I'm getting records now

Thanks @Joerg.Findeisen & @sergeyken


I strongly recommend to start using //SYMNAMES DD field layout definition, even for very first and very primitive tasks.

Code:
//SYMNAMES DD  *
SMF208LEN,*,2,BI       /*RECORD LENGTH*/
SMF208SEG,*,2,BI       /*SEGMENT DESCRIPTOR*/
SMF208FLG,*,1,BI       /*SYSTEM FLAGS*/
SMF208RTY,*,1,BI       /*RECORD TYPE*/
SMF208TME,*,4,BI       /*TIME RECORD WRITTEN TO SMF BUFFER*/
SMF208DTE,*,4,BI       /*DATE RECORD WRITTEN TO SMF BUFFER*/
SMF208SID,*,4,CH       /*SYSTEM ID*/
//*
Back to top
View user's profile Send private message
AlexSalas95

New User


Joined: 18 Mar 2024
Posts: 21
Location: United States

PostPosted: Mon Jan 05, 2026 8:01 pm
Reply with quote

@sergeyken, thanks this is really interesting

I'll need to do more research into this, but it looks like I might be able to leverage this to handle variable offset files, like how the most (all?) SMF records are written
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2275
Location: USA

PostPosted: Mon Jan 05, 2026 8:16 pm
Reply with quote

AlexSalas95 wrote:
@sergeyken, thanks this is really interesting

I'll need to do more research into this, but it looks like I might be able to leverage this to handle variable offset files, like how the most (all?) SMF records are written

One of my projects included conversion of hundreds of COBOL-based report generation programs to their SORT-based versions.

That time I created a REXX procedure to automatically create SYMNAMES equivalents for multiple COBOL copybooks. It's not in my posession by this time, but I remember it was not a big challenge.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts To Sort detail records in a file with... SYNCSORT 5
No new posts Identify and write records containing... SYNCSORT 11
No new posts Filter records where condition is in ... SYNCSORT 6
No new posts Extract records for a specific condit... DFSORT/ICETOOL 25
No new posts Simplify SORT CARD to combine INREC a... DFSORT/ICETOOL 6
Search our Forums:


Back to Top