MIKES_SCL_EDIT
MSCLED

Summary

MIKES_SCL_EDIT allows one file to be edited to another using SCL commands to manipulate the input and output records.

MIKES_SCL_EDIT(
@literal@INFILE,
@literal@OUTFILE,
@literal@EDITSCL:= VAL "OUT := IN",
@literal@NOBLANK:= Y,
@response@RESPONSE:= RESULT)

Parameter details

KeywordMeaningDefault
INFILE The name of the input file to be edited

= file_name

None. The parameter is mandatory
OUTFILE The name of the file to contain the edited records

= file_name

None. The parameter is mandatory
EDITSCL The SCL to be obeyed to create the record to be written to OUTFILE

= SCL line

The output record will be the same as the input record
NOBLANK Specifies whether the output record is to be written if it is blank

= Y
The record is not to be written when it is blank

= N
The record is to be written when it is blank

Y. Blank records are not to be written.

The EDIT_SCL parameter

This allows complex manipulation of the input file to create output records. The input file records are put into the variable IN, and the record to be written is set up in the variable OUT. There need not be a 1:1 correspondence between input file records and output file records. If OUT is blank and NOBLANK is "Y", no output record will be written. Conversely, the executed SCL may set a boolean variable NOREAD to TRUE, in which case the input file will not be read (ie. multiple output records may be created from one input record).

Examples

This is a simple example to add a record length to the start of a record (in this case, a byte count):

MSCLED(INF = ANYFILE,
       OUT = LENGTHFILE,
       EDI = "OUT := BIN((LENGTH IN + 4), 4) + IN")

This is a more complex example illustrating the potential for using conditions and reformatting the output.

STRING A := FILL(17)
STRING B

B := "IF IN STARTSWITH '   ' THEN OUT := '' " +
     "ELSE OUT := A; A := SUBSTR(IN,,13) + 'YYYY' FI;" +
     "IF IN INCLUDES 'CG-ACCOUNT'     THEN SUBSTR(A, 13) := 'N' FI;" +
     "IF IN INCLUDES 'GAS-ACC-CONTAC' THEN SUBSTR(A, 14) := 'N' FI;" +
     "IF IN INCLUDES 'SUPPLY ADDRESS' THEN SUBSTR(A, 15) := 'N' FI;" +
     "IF IN INCLUDES 'ACCOUNT ADDRES' THEN SUBSTR(A, 16) := 'N' FI"

MSCLED(INF = ACCREFERR,
       OUT = ACCREFS,
       EDI = VAL B)

The input file in the above example contains

1001001003377     NO CG-ACCOUNT RECORD
                  NO ACCOUNT ADDRESS RECORD
                  NO SUPPLY ADDRESS RECORD
1001001017468     NO CG-ACCOUNT RECORD
1001001017479     NO CG-ACCOUNT RECORD
1001001020011     NO CG-ACCOUNT RECORD
                  NO ACCOUNT ADDRESS RECORD
                  NO SUPPLY ADDRESS RECORD
1001001020229     NO CG-ACCOUNT RECORD
                  NO ACCOUNT ADDRESS RECORD
                  NO SUPPLY ADDRESS RECORD
1001001023777     NO CG-ACCOUNT RECORD
                  NO ACCOUNT ADDRESS RECORD
                  NO SUPPLY ADDRESS RECORD

and the resulting output file contains

1001001003377NYNN
1001001017468NYYY
1001001017479NYYY
1001001020011NYNN
1001001020229NYNN
1001001023777NYNN