extract_xmi_PS.c


History

The dasdload utility can be used to place TSO XMIT format files onto a hercules CCKD disk image if the XMIT file is for a partitioned dataset. It is not able to process the TSO XMIT file if it contains a sequential file.

Normally not a problem, XmitManager from the cbttape.org site can be used to extract those... except... XmitManager won't run on a 64bit Win7 machine which is all I had available to me; well that and a CentOS6.0 VM running under it but I didn't want to install Wine into the VM just to run XmitManager.

Purpose

I needed to extract a DSORG=PS (sequential) file from a TSO XMIT file, specifically CBT249 file 056. I wrote this quick and dirty program to achieve that task for me, and it works perfectly for that file.

I have not tested it on any other sequential TSO XMIT files, will wait until I need to :-), although it should work. If I need to use it again on any other files I'll update this page.

The program is posted here in case it may be of use to anyone else. It will only work on TSO XMIT files containing text data; I know that there are some files on cbttape.org that are TSO XMIT files containing DSORG=PS datasets with binary data in them (cbt249 file 293 springs to mind), and it definately will not work on those as the program will drop bytes from the datastream, needed to get clean output from text files, as you will see from the code.

Requirements

  1. A linux server of course, to compile the program on
  2. The TSO XMIT file must be converted from EBCDIC to ASCII, just use dd
  3. Example usage, on file056

    dd conv=ascii if=CBT056.XMI of=CBT056.XMI.TXT
    ./extract_xmi_PS CBT056.XMI.TXT > file_contents.txt  # output is to stdout
    

    The code

    Provided as a link to the source file to be on the safe side, html displays tend to strip out some characters that are important in code displays :-).

    As this was a quick and dirty implementation to get that one file I needed you are welcome to change this to meet your needs as required.