Before writing to a DASD volume it is a good idea to make a backup.  While I was testing TXXIPL2D I managed to erase the VOL1 record.  It is very easy to make a coding mistake that could leave the volume completely unusable.  In my case I was able to write a program that simply rewrote a VOL1 record and all was good.  If I had managed to damage the VTOC I would have had to format the volume resulting in a loss of all the data.  Since the only data on the volume I am writing to is for testing my TXX code it wouldn’t be the end of the world.  My source code is safely on another volume.

Writing the IPL1 and IPL2 records is pretty straight forward.  Because they already exist on the volume we only need to update them.  We can use the Write Data (x’05’) to update the record data.  The Write Data command will only overwrite the data portion of the record. We Seek/Search ID for the record we want to update and then chain on the Write Data.  If we write less data than the record size, the remainder of the record will be padded with zeros.

To write the IPL Text in record 4 we need to use the Write CKD (Count, Key, Data) command.  This command will format a record on the track.  Any records following the record on the track will be erased.  (This is how I managed to erase the VOL1 record).  To use Write CKD we have to seek for the previous record. So to write record 4 we need to seek to record 3.

The data transferred must include the eight byte count area, the key data (if any), and the data.  A record with a data length of zero is an End Of File (EOF).

The count area is eight bytes long and has three fields – the record ID (CCHHR), the Key Length, and the Data Length.  The key length is 1  byte (maximum 256) and the Data Length is 2 bytes.

For our IPL text record no key is needed and the length is determined by the size of the IPL text data.

To get the IPL text data we can read it from an object deck.  We can use a procedure similar to how we loaded an object deck in our Absolute Loader.  In this case we can load the the object deck into a work area that becomes the buffer for our write command.

I also included the ability to read the DASD device address from a card.  The format 0f the control card is: DEVICE=xxx where xxx is the device address we will write to.

To write the IPL text to our DASD volume we need to begin with our Absolute Loader.  It will then load and transfer execution to TXXIPL2D.  It will then the control card from the card reader.  Immediately following the control card should be the IPL object deck to write to the DASD.

Here is the JCL I used:

//IPL2D    JOB 5222,'IPL TO DASD',CLASS=A,MSGCLASS=A,
//        MSGLEVEL=(1,1)
/*JOBPARM K=0
//*
//*
//TXXOSRUN EXEC  PGM=ABSLOAD
//STEPLIB  DD    DISP=SHR,DSN=TXXOS.CARD.LOAD
//PUNCH    DD    UNIT=00D
//*
//*
//ASM      EXEC  PGM=IFOX00,REGION=1024K,
//         PARM='LINECOUNT(44),TERM'
//SYSLIB   DD    DISP=SHR,DSN=SYS1.MACLIB
//         DD    DISP=SHR,DSN=SYS1.AMODGEN
//         DD    DISP=SHR,DSN=TXXOS.DOS.ASM
//SYSUT1   DD    DSN=&&SYSUT1,UNIT=VIO,SPACE=(1700,(600,100))
//SYSUT2   DD    DSN=&&SYSUT2,UNIT=VIO,SPACE=(1700,(300,50))
//SYSUT3   DD    DSN=&&SYSUT3,UNIT=VIO,SPACE=(1700,(300,50))
//SYSTERM  DD    SYSOUT=*
//SYSPRINT DD    SYSOUT=*
//SYSPUNCH DD    UNIT=00D
//SYSIN    DD    DISP=SHR,DSN=TXXOS.DOS.ASM(TXXIPL2D)
//*
//GENR1    EXEC  PGM=IEBGENER
//SYSPRINT   DD  SYSOUT=*
//SYSIN      DD  DUMMY
//SYSUT2     DD  UNIT=00D
//SYSUT1     DD  *
DEVICE=345
/*
//*
//GENR2    EXEC  PGM=IEBGENER
//SYSPRINT   DD  SYSOUT=*
//SYSIN      DD  DUMMY
//SYSUT2     DD  UNIT=00D,DCB=(BLKSIZE=80,LRECL=80)
//SYSUT1     DD  DISP=SHR,DSN=TXXOS.DOS.OBJ(TXXIPL)
//*

My TXXIPL module is simply an updated copy of the DBOOT3 program.  It will locate a data set named TXXOS.SYSLIB and then load TXXNUC into memory and transfer control.

We now have the ability to IPL from a DASD volume.

[Next –  TXXNUC]