QUIP Software Logo

Some older statistical programs export data to ASCII files in which each record is broken into 80 column "card" images on separate lines, but most software today, including QBAL and QTAB, considers each line terminated by an end-of-line marker (CR-LF on a PC) to be a separate data record.

The following QGEN example converts files consisting of multiple 80-byte lines into fixed record length files that can be processed with QBAL or any other software that can read fixed record length data files with no end-of-line markers.

****************************************************************************
* CARDS2FF.QGS - 3/29/00 - Rev.00 - Convert multiple cards to fixed LRECL
****************************************************************************

* This QGEN spec will convert a file with multiple "cards" per record
* and one card image per line to a fixed record length file with no
* end-of-line markers (CR-LF) between records.
*
* The data must have exactly the same number of "cards" per case and
* these must be in the same physical sequence within each case record.
*

* Input file - variable length (CR-LF at the end of each)
INTAP1  LineCard.asc    ( 80 v
* Output file - fixed length (no CR-LF between records)
OUTAP1  FlatFile.asc    ( 80

SETUP   ADDRMODE c
RUNOPS  CLEAR 1,80

END

The following QGEN specifications reverse the conversion performed in the preceding example. This can be used to convert output from QBAL back into the format expected by the statistical program that created the original.

****************************************************************************
* FF2CARDS.QGS - 3/29/00 - Rev.00 - Convert multiple cards to fixed LRECL
****************************************************************************
* Reverses the process of CARDS2FF.QGS

* Input file - fixed length (no CR-LF between records)
INTAP1  FlatFile.asc    ( 80
* Output file - variable length (CR-LF at the end of each)
OUTAP1  LineCard.asc    ( 80 v

SETUP   ADDRMODE c
RUNOPS  CLEAR 1,80

END 

Both examples work regardless of the number of "cards" that make up a data record. They can be easily modified to combine "cards" into data records terminated by end-of line markers.