CDS054

Window Text - Copy/Append/Delete

Last Revised: 02/16/14

This program can be used to copy/append and/or delete window based text created with the W type option of CDS069. It is strongly suggested that you use this routine to copy or delete window based text, since there are data structure changes planned to support new features of window based text. Hardcoded logic to copy or delete may fail when these new features are implemented.

Window Text is also frequently called Notepad text.

Due to the structure of window text files, you cannot simply move the file using the File Utility when it becomes necessary to increase the text ID size or the characters per record. Instead, define the new file with the keysize and characters per record required, then use CDS054 to transfer the data to the new file.

Window text files use multiple records to store text. Each record has a single character suffix, in addition to the text ID. This limits the text for each text ID to be 256 records.  Window text files can be defined with any characters per record, but the characters per record will limit the total size of the text.  For most text files, setting the characters per record to 128 will provide for over 250 lines of text with some use of attributes (bold, underline, etc.).  In some cases, the text might require more than 250 lines, in which case you would set the characters per record to 256, 512, 1024 or even larger.

Calling Format:

CALL "CDS054", Y$, CHAN, TEXTID$, { NEWID$, NEWCHAN, HEADING$ }

CDS054
Y$ session control variable
CHAN Channel number of window based text file opened by calling program
TEXTID$ Copy 'from' text ID
NEWID$ Copy 'to' text ID.  If not passed, or null, then copy from ID text will be deleted.  Existing text with a textid of NEWID$ will be deleted unless HEADING$ is passed as null, or with some value. The 'copy from' text is not altered when copying or appending. The original text can be deleted using another call to CDS054. See example below.
NEWCHAN Channel number of copy 'to' file. If zero, or not passed to CDS054, then the text will be copied to the file opened to CHAN.
HEADING$
Not included in argument list Perform delete or copy
Passed as null Append text with ID of TEXTID$ to text with ID of NEWID$
Passed as non-null text Append HEADING$ to text of NEWID$ followed by text of TEXTID$.  Typically used to indicate the user and date the text was appended.  Useful when a single notepad text contains a chronological listing of activity.  See example.

Note that when using the NEWCHAN option to copy text to another file, the new file key size and/or characters per record may be different from the "copy from" file.

Examples
Delete notepad text from file name XXCM06 with key of CUSTNO$+"A":
CALL "CDS095",CM06,"XXCM06","YNX"
CALL "CDS054",Y$,CM06,CUSTNO$+"A"
Copy notepad text from file name XXCM06 with a key of OLDCUSTNO$ to NEWCUSTNO$:
CALL "CDS095",CM06,"XXCM06","YNX"
CALL "CDS054",Y$,CM06,OLDCUSTNO$,NEWCUSTNO$
Copy notepad text with ID "1234" from file name XXCM06 to file XXVM06 with a new ID of "123456":
CALL "CDS095",CM06,"XXCM06","YNX"

CALL "CDS095",VM06,"XXVM06","YNX"
CALL "CDS054",Y$,CM06,"1234","123456",VM06

Append notepad text from file name XXCM06 with a key of OLDCUSTNO$ to the same file with a key of NEWCUSTNO$ without any separator between original and appended text, then remove notepad text of OLDCUSTNO$.

CALL "CDS095",CM06,"XXCM06","YNX"
CALL "CDS054",Y$,CM06,OLDCUSTNO$,NEWCUSTNO$,0,""

CALL "CDS054",Y$,CM06,OLDCUSTNO$
Append notepad text from a temporary file FILNAM$ with a key of CBP$ to file RLSC06 with the same text ID with a separator between original and appended text showing the date and user who authored the appended text:
CALL "CDS095",TMP,FILNAM$,"YNX"
CALL "CDS095",SC06,"RLSC06","YNX"
CALL "CDS054",Y$,TMP,CBP$,"",SC06,DATE(0:"%Ds %Mz/%Dz/%Yz")+" by Elsie Dawson"