ONXCONV Convert Files to another format

ONXCONV [ 'str1'=... | PRE=prefix | SUF=suffix ] , attrib | ? [, opt]

The files/library elements marked with the Action Code X will be used as input for the conversion.

The names of the converted files will be those of the input files/library elements, unless:

- the string 'str1' is replaced by 'str2' (for more information, see page 5-),

- the name is prefixed: PRE=prefix (e.g. PRE=CONV.), or

- the name is suffixed: SUF=suffix (e.g. SUF=.CONV).

If neither 'str1'=..., nor PRE=prefix, nor SUF= suffix is specified, then the input file or input element is converted to a temporary file, and finally copied back to the original data object. The temporary file is then erased.

attrib Attributes of the output file. The attributes are defined in the syntax of a FILE or ADD-FILE-LINK command.

Example (parameter in FILE command syntax):

FCBTYPE=ISAM,KEYLEN=20,KEYPOS=8,BLKSIZE=(STD,16), SPACE=(64,64)

Example (parameter in ADD-FILE-LINK syntax):

ACCESS=*ISAM,SUPP=*DISK(ISAM=(KEY-LEN=20,KEY-POS=8)),BUFFER-L=*STD(16)

? The assisted SDF dialog screen of the /ADD-FILE-LINK (ADFL) command will be displayed.

The predefined values of first two parameters (LINK-NAME=OUTFCB and FILE-NAME=CFS...) may not be modified or deleted.

To modify the data structure, enter the following:

BLKCTRL= PAMKEY | DATA | DATA4K | NO

Example: ONXCONV BLKCTRL=DATA

The Variable Action ONXCONV BLKCTRL=NO will invoke the utility program PAMCONV to process program executables and PLAM libraries.

opt one or more of the following options:

Padding C'string' | X'string'

IK Insert Keys

EK Eliminate Keys

NA Non Ascending Keys

S Same attributes

LEN=n Logical record length

Padding Character string with which the output record will be padded if it is longer than the input record. Standard: C'_'.

IK Insert Keys: CFS will generate the ISAM keys for the output file automatically. The IK option can be used to create key fields even if the output file is a SAM file. In this case, the output records will have an 8 digit ascending sequential number after the record length field.

Standard: no IK, i.e. the ISAM key is contained in the data to be converted. If the ISAM key is not in ascending order, the NA (Non Ascending Keys) option should be given: see below.

EK Eliminate Keys: When converting from ISAM to SAM, the ISAM key will be removed from the input record.

Standard: no EK, i.e. if the input file is an ISAM file, the key will not be removed when converting the file.

NA Non Ascending Keys: When converting to an ISAM file, the input records contain the data for the ISAM key. These will not necessarily be in ascending sequence, so CFS will use the STORE macro instead of PUT. The NA statement will result in the input records being sorted.

Standard: no NA. A non-ascending key in the input record will lead to a DVS error.

S Same attributes: The output file will have the file attributes as specified in the ONXCONV... statement. All file attributes not specified will be taken from the input file.

The S option must always be the last option specified in the CONV Variable Action. It is only applicable as from BS2000 Version 9.5.

Standard: For all file attributes not specified with ONXCONV ..., the standard BS2000 values will be used: FCBTYPE=ISAM, RECFORM=V, BLKSIZE=(STD,1), KEYPOS=5, KEYLEN=8.

LEN=n specifies the total length of the output records. To achieve this length, the records are padded right with blanks. The four byte record length field is included in the LEN= statement. The catalog entry RECSIZE is not affected, and for variable length records will have the value RECSIZE=0.

Standard: The record length for output files with RECFORM=V will be determined by the input record.

Notes:

If the output file is to be in RECFORM=U format, the RECSIZE=8 parameter should be given (Register 8 is used by the program for the length of the output record).

It must be remembered when specifying attributes for the output file that those attributes that are not specified will have the respective standard values assigned to them. If no attributes are specified, the following standard values are used:

FCBTYPE=ISAM,KEYPOS=5,KEYLEN=8,RECFORM=V,BLKSIZE=(STD,1).

See example 2 below for more information.

The BLKCTRL parameter is an execption to the above rule on standard attribute values. If the attribute begins with BLKCTRL=, the output file will be defined with the same attributes as the input file, up to the BLKCTRL values, and PAD, if specified. See example 3 below.

The ONXCONV Variable Action can be used to convert SAM/ISAM files to PAM format, and vice versa. The following cases should be distinguished:

SAM/ISAM --> PAM    ( ONXCONV .... , FCBTYPE=PAM )

1) Input file: BLKSIZE = (STD,1)

The input file (SAM/ISAM) is read by PAM blocks, and written in PAM format to the output file. The data content is left unchanged. In this case, only the FCBTYPE entry in the catalog is changed to PAM.

2) Input file: BLKSIZE > (STD,1)

It is assumed that the first 16 bytes of each input record of the SAM/ISAM file (Recform=V) contains the PAM key data. Thereafter, 2048 bytes is expected for each PAM block.

PAM --> SAM/ISAM    ( ONXCONV .... , FCBTYPE=SAM/ISAM )

1) Output file: BLKSIZE = (STD,1)

ONXCONV ... ,FCBTYPE=SAM/ISAM,BLKSIZE=(STD,1)

The input file is transferred PAM block by PAM block to the output file. The data content is not changed. In this case, only the FCBTYPE entry in the catalog is changed from PAM to SAM/ISAM.

2) Output file: BLKSIZE > (STD,1)

e.g.: ONXCONV ... ,FCBTYPE=SAM/ISAM,BLKSIZE=(STD,2)

The first 16 bytes of each output record will contain the PAM key of the input blocks. Thereafter, 2048 data bytes from the PAM block will be appended.

Examples:

ONXCONV SUF=.F80,RECFORM=F,RECSIZE=80,FCBTYPE=SAM

The files marked with Action Code X will be converted to SAM files with RECFORM=F ,RECSIZE=80. The names of the converted files will be the same as the input files, but suffixed with '.F80'.

ONXCONV PRE=#,IK,LEN=300

The files marked with the Action Code X (either SAM or ISAM) will be converted to ISAM files using the standard file format: FCBTYPE=ISAM,RECFORM=V,KEYPOS=5,KEYLEN =8. The ISAM key will be generated, even if keys exist (IK). The output records are padded with blanks up to 300 bytes. If any input records are longer than 300 bytes, these will be truncated. The name of the output file will be the same as the input file, except that it will be prefixed with a '#' character (i.e. a temporary file).

ONXCONV BLKCTRL=DATA

The files marked with the Action Code X will be converted to the internal format BLKCTRL=DATA. The input file will be overwritten with the output file following a successful conversion. In contrast to the previous example, all input file attributes with the exception of BLKCTRL will be transferred to the output file automatically (i.e. without specifying the S option).

ONXCONV' '='.SAM',FCBTYPE=SAM,LEN=80

The files marked with the Action Code X will be converted to files with FCBTYPE= SAM,RECFORM=V,BLKSIZE=(STD,1). The output file names will be the same as the input names, but suffixed with '.SAM'.

ONXCONV' '='.SAM',FCBTYPE=SAM,EK,S

The files marked with the Action Code X will be converted to SAM files. In contrast to the previous example, the output file will only be cataloged as FCBTYPE=SAM. The RECFORM, RECSIZE and BLKSIZE values will be taken from the respective input files (S: Same attributes). If the input file is an ISAM file, then the ISAM keys will be removed from the records when converting to a SAM file. (EK: Eliminate Keys).

ONXCONV'.D.'='.D.NEW.',FCBTYPE=ISAM,KEYPOS=200,KEYLEN=20,IK

The files marked with the Action Code X are converted to ISAM files. The names of the output files are constructed by replacing the string '.D.' with '.D.NEW' . If any of the files marked with an X do not contain the string '.D.', then these files will not be converted.

The ISAM files thus created will have attributes of KEYPOS=200 and KEYLEN=20. The data for the ISAM keys will be generated by CFS itself, and does not have to be contained within the sequential input data (IK: Insert Keys). When generating the output file keys, CFS will follow these rules: The first 8 characters of the key are numerical (increment=10). If the key being created exceeds 8 bytes, then the succeeding positions will be set to binary zero.

Splitting a large sequential file into multiple identically-sized partial files

1) Display the original file with Action Code D.

2) Enter a PAM command (convert the file to PAM format). It is then possible to transfer physical PAM blocks from the input file to another file. In normal display mode, only single records can be written to another file.

3) Enter a CFS Write command, Wn,partfile-x. This will cause n PAM pages from the input file to be written to the partial file with FCBTYPE=PAM. The partial files must have different names.

4) Return to the CFS Selection mask (NP command), and select all the partial files.

5) Convert the partial PAM files created with the Write command to files with FCBTYPE=SAM: ONXCONV SUF=.SAM,FCBTYPE=SAM