How to get a Sequential file from XCOM History file for reporting or other purposes.

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

How to get a Sequential file from XCOM History file for reporting or other purposes.

There is an easy way to get a Sequential file from the XCOMHIST History file (in z/OS) containing the main fields in a readable format so it could be used for printing a report or sending it to another platform to process in an Excel sheet or other tool. The process uses the IBM program DFSORT (ICEMAN) to reformat the records and some fields from the Xcom History file creating a new Sequential flat file. The example provided produces an output record of 150 bytes but could be used as a prototype to easily include or remove output fields.


The following is an example on how to get a Sequential file using as input the Xcom History file.

1. Fields description Input-Output:
The fields listed will be extracted and reformatted to leave them in a readable format (not Binary or Decimal Packet ):
HSTDSECT        HISTORY          Output           Description
field name      length format    length format
HSTLUSER        (12) Char        (12)  Char       LOCAL USER ID
HSTID           (10) Char        (10)  Char       IDENT FIELD
HSTLDSN         (44) Char        (44)  Char       LOCAL DATASET NAME
HSTSDATE         (3) Pack         (5)  Char       Start date  YYDDD
HSTSTIME         (4) Pack         (7)  Char       Start time  HHMMSSm
HSTEDATE         (3) Pack         (5)  Char       End date  YYDDD
HSTETIME         (4) Pack         (7)  Char       End time  HHMMSSm
HST#UNCB         (4) Bin         (10)  Char       NUMBER OF UNCOMPRESSED BYTES
HST#CMPB         (4) Bin         (10)  Char       NUMBER OF COMPRESSED BYTES
HST#RECS         (4) Bin         (10)  Char       NUMBER OF RECORDS TRANSMITTED
HSTTNAME        (15) Char        (15)  Char       TCP/IP NAME OR ADDRESS 
2. JCL and parameters:
//REFORMAT EXEC  PGM=ICEMAN                                             
//STEPLIB    DD  DSN=SYS1.SORTLPA,DISP=SHR       IBM DFSORT that contains ICEMAN                           
//SYSOUT     DD  SYSOUT=*                                            
//SYSIN      DD  *                                                   
  SORT       FIELDS=(1,1,CH,A)                                          
  OPTION   COPY,SKIPREC=1                                         
  INREC      FIELDS=(2:29,12,15:99,10,26:122,44,                       
//SORTIN     DD DSN=*hlq*.XCOMHIST,DISP=SHR           your Xcom History file
//SORTOUT    DD DSN=your.sequ.file,DISP=(,KEEP),      your Sequential file
//   UNIT=SYSDA,SPACE=(TRK,(100,20)),                 adjust quantity as needed
//   DCB=(LRECL=150,RECFM=FB,BLKSIZE=15000)           adjust if add/remove output fields
The example job does not sort the records, just takes them in the order they are in the History file, reformats them and writes them to the output file. However it is possible to include other parameters to sort them in any sequence, to exclude records or other possibilities (please see Additional Information).
Additional Information:

. The HSTLDSN field in the History file has a length greater than (44) Characters but this example takes only this length that is the maximum dataset name on the z/OS.
. The example takes all of the history records except the first one (internal use), but if necessary records can be filtered with additional parameters.
. For additional parameters please review the IBM DFSORT Application Programming Guide.