Hi team,
I would appreciate your ideas on how I could update the very last character of the last record in a FB(80) dataset.
This dataset is the result of a split of a larger one, with each chunk having approx. 1/2 a million records, all of the same layout. For this reason, I cannot use 'IFTRAIL=' as there is nothing to identify the last record as a trail. And the last chunk contains an unknown number of remaining records. Each chunk has to replace its last character to a special one indicating the end of the dataset!
I am thinking of using (another) SUBSET to isolate the last record, update it, using OVERLAY or FINDREP, and then concatenate to the original-1 record set, but since this is a repetitive process that splits the dataset in multiple ones, and the last will have an unknown number of records, this gets a bit more complcated.
I wonder if there would be a simple method to update the last char of the last record, whitout using SUBSET.
Thank you
GG
/* REXX */
FIXUNIX:
"NEWSTACK"
"EXECIO * DISKR INDD (FINIS"
"EXECIO 0 DISKW OUTDD (OPEN"
Do iRec = 1 By 1 While Queued() > 0
Parse Pull NewRecord
If Queued() = 0 Then Do /* last record detected! */
LastChar = Right( NewRecord, 1 )
If LastChar = '1E'x Then /* remove '1E'x before appending '1D'x */
NewRecord = Left( NewRecord, Length(NewRecord) - 1 )
NewRecord = NewRecord || '1D'x /* append to the last record only */
End
Push NewRecord
"EXECIO 1 DISKW OUTDD"
End iRec
"EXECIO 0 DISKW OUTDD (FINIS"
"DELSTACK"
Return 0