CDS261

Return Window/Notepad Text

Last Revised: 11/16/16

This routine is used to return information about window based text created with the W type option of the input routine CDS069.  It is typically used when you need to display the first part of the window text, or to determine how many lines the text will require when printed to a printer.  This routine is also used to convert window text to html format for emailing or displaying on a web page, or to convert to the format used for entry on a web page within <textarea> tags.  Window text is often called a Notepad by application software.

Related programs:

CDS069 - used to display or maintain window text.

CDS257 - used to print window text to a printer, or to write back modified text to the text file.

CDS554 - used to print window text within a grid.

Calling Format:

CALL "CDS261", Y$, FILCHAN$, TEXTID$, TEXT$, { LINES, FULL$, HTML$, HTMLFONT, TEXTAREA$, S261$}

CDS261
FILCHAN$ In Can be a channel number of the text file already opened, or the file name where the text is stored.  When the file name is passed, CDS261 will open the file using the U option of CDS095, and not close it.
TEXTID$ In The Text ID such as the customer#, vendor#, item#, or other identification of the window text.
TEXT$ Out String up to 80 characters long containing the first part of the window text.  TEXT$ will not contain any attributes such as underlined, bold, etc. White space within the text are stripped out of TEXT$ with the intent to return the maximum amount of information in TEXT$.  No error is returned if there is no text on file.  TEXT$ will be null in that case.  TEXT$ is typically displayed to the right of some field# or description letting the operator know that there is some text on file.
LINES Out The number of display lines of text in the entire message.  Returned as zero if there is no notepad text on file.
FULL$ Out Contains the entire text, including imbedded line feeds and attribute mnemonics.  Since it can be quite large, you suppress this logic by excluding FULL$ on the CALL.  FULL$ may be needed when an application program needs to append some text onto the end of the stored text.  The application program could also manipulate the contents of FULL$ prior to writing the text back.  Use CDS257 with the STS$="W" to write window text back to the disc, after modification by the application program.  Use CDS257 with STS$="T" to return text without line feeds and mnemonics.
HTML$ Out Contains the entire text formatted in html.  The notepad text is rendered in a fixed point font of Lucida Console, Arial Monospaced, Courier New, or Courier if HTMLFONT parameter is not included on CALL or passed with a value of zero.
AttributeNote
boldrendered as bold
underlinerendered as underlined text
reverserendered using an italics font
blinkrendered as blinking text, but not all browsers and email clients can blink text.
graphicsrendered as box drawing characters
HTMLFONT In Optionally pass as 1 to exclude paragraph tags in HTML$ that specify a fixed width font.
TEXTAREA$ Out Contains the entire text in a format suitable for Dynaweb entry within <textarea> tags.  Note that textarea does not support any attributes such as bold, underlined, reverse video, etc., but it can be used for plain text including line breaks.
S261$ Out Contains the following text heading fields
Field NameContents
REVInternal revision number of text record structure
COLSNumber of display columns specified when text was first created
ROWSNumber of display rows specified when text was first created
OPERIDOperator ID that created or last modified this text
DATECHGJulian date when text was created or last changed. Use DATE(DATECHG,TIMECHG:"myFormat") to format date and time.
TIMECHGTime in TIM format when text was created or last changed
TEXTLENTotal number of characters contained in text
CDS261 is used in the example below to retrieve the first part of the message.  It is displayed to the right of field#8 Message, and is stripped of all special attributes such as underlining, bold, blink, etc.
CALL "CDS261",Y$,STR(SM21),TEXTID$,TEXT$
IF LEN(TEXT$)>60 THEN LET TEXT$=TEXT$(1,60)+"..."

Example for Dynaweb Application
This example retrieves existing Notepad Text from a file named TEXTFILE$ with Notepad ID of TEXTID$ and then sets the text as the default entry on the web page.
CALL "CDS261",Y$,TEXTFILE$,TEXTID$,"",0,"","",0,NOTEPAD$
HTML$="<textarea name='NOTE' cols='80' rows='15'>"+NOTEPAD$+"</textarea>"
Example of S261$ fields available
CALL "CDS261", Y$, "CDDD13" ,PAD("DD00",10)+"BBJPREFIX", TEXT$, LINES, FULL$, HTML$, HTMLFONT, TEXTAREA$, S261$