Titus Information Systems, Inc.

Standard Library
CSDisCreate Class

An instance of this class is used by an application to create a Standard Display text file.  This class is normally instantiated by a call to the SDIS$O COBOL function.  The following public member functions are available to the C++ programmer:

CSDisCreate::CSDisCreate()
This is the constructor.  It initializes the data members.
void CSDisCreate::Open(CString FileName)
This member function creates an empty output file.  Specify the complete path name in FileName.  If the file is successfully created, CSDisCreate::ReturnCode will be zero.  If the file is already opened, CSDisCreate::ReturnCode will be -1.  If the file creation fails, CSDisCreate::ReturnCode will be -2.
void CSDisCreate::Close()
This member function closes the created Standard Display text file.  If there is no file open, CSDisCreate::ReturnCode will be -1; otherwise, it will be zero.
void CSDisCreate::StartFile(char*Buffer)
This member function creates the file header.  It must be called immediately after the CSDisCreate::Open() function.  Buffer[0] must contain a P (portrait) or an L (landscape).  Buffer[1] through Buffer[5] must contain a PIC 9(5) with the maximum number of pages that will be written to the file.  Using this number, memory buffers will be initialized.  If there is no file open, CSDisCreate::ReturnCode will be -1.  If memory cannot be allocated for the page pointers, CSDisCreate::ReturnCode will be -2.  If memory cannot be allocated for the line pointers, CSDisCreate::ReturnCode will be -3.  If the function is successful, CSDisCreate::ReturnCode will be zero.
void CSDisCreate::EndFile()
This member function creates the file trailer.  It must be called immediately before the CSDisCreate::Close() function.  The file trailer contains the exact statistics for the file and is used by the CSDisView class to display the file.  If there is not a currently started file, CSDisCreate::ReturnCode will be -1.  If the function is successful, CSDisCreate::ReturnCode will be zero.
void CSDisCreate::StartPage(char*Buffer)
This member function creates the page header.  It must be called immediately after the CSDisCreate::StartFile() function and at the beginning of each subsequent page.  If there is not a currently started file, CSDisCreate::ReturnCode will be -1.  If the maximum number of pages is exceeded, CSDisCreate::ReturnCode will be -3.  If the function is successful, CSDisCreate::ReturnCode will be zero.  The function is called with the following Buffer:
       01  PAGE-HEADER.
           03  PH-LPI     PIC 99.   (Lines per inch)
           03  PH-TOP     PIC 99.   (Top Margin in lines)
           03  PH-LENGTH  PIC 999.  (Page length in lines)
           03  PH-CPI     PIC 99.   (Characters per inch)
           03  PH-LEFT    PIC 99.   (Left Margin in characters)
           03  PH-WIDTH   PIC 999.  (Line width in characters)
void CSDisCreate::EndPage()
This member function creates the page trailer.  It must be called at the conclusion of each page.  The page trailer contains the exact statistics for the page and is used by the CSDisView class to display the page.  If there is not a currently started file, CSDisCreate::ReturnCode will be -1.  If the function is successful, CSDisCreate::ReturnCode will be zero.
void CSDisCreate::StartLine(char*Buffer)
This member function creates the line header.  It must be called immediately after the CSDisCreate::StartPage() function and at the beginning of each subsequent line.  If there is not a currently started page, CSDisCreate::ReturnCode will be -1.  If the function is successful, CSDisCreate::ReturnCode will be zero.  It is called with a single character in Buffer as follows:
H: Header Line, single space; data packets follow
I: Header Line, double space; data packets follow
0: Overstrike; data packets follow
1: Single Space; data packets follow
2: Double Space; data packets follow
3: Triple Space; data packets follow
4: Three blank lines; data packets follow
5: Four blank lines; data packets follow
6: Five blank lines; data packets follow
7: Six blank lines; data packets follow
8: Seven blank lines; data packets follow
9: Eight blank lines; data packets follow

void CSDisCreate::EndLine()
This member function creates the line trailer.  It must be called at the conclusion of each line.  The line trailer contains the exact statistics for the line and is used by the CSDisView class to display the line.  If there is not a currently started line, CSDisCreate::ReturnCode will be -1.  If the function is successful, CSDisCreate::ReturnCode will be zero.
void CSDisCreate::Packet(char*Buffer)
This member function adds a print packet to the current line.  It may be called as many times as are required to create the print image for the line.  If there is not a currently started line, CSDisCreate::ReturnCode will be -1.  If the maximum number of packets per line is exceeded, CSDisCreate::ReturnCode will be -2.  If the function is successful, CSDisCreate::ReturnCode will be zero.  The format of a print packet is as follows:
       01  PRINT-PACKET.
           03  PP-HEADER.
               05  PPH-LPI     PIC 99.    (Lines per Inch)
               05  PPH-CPI     PIC 99.    (Characters per Inch)
               05  PPH-TAB     PIC 999.   (Tab Stop)
               05  PPH-TYPE    PIC X.     (Type Flag)
               05  PPH-STYLE   PIC X.     (Style Flag)
               05  PPH-LENGTH  PIC 999.   (Length)
           03  PP-DATA         PIC X(n).  (Data Area)
PPH-TYPE is as follows:
L: Left-justified text (Tab Stop is the left side of the text)
R: Right-justified text (Tab Stop is the right side of the text)
C: Centered text (Tab Stop is the center of the text)
P: Page number
H: Horizontal line
V: Vertical line
U: Underline
B: Box, lines only
A: Heading cap, lines only
S: Shaded box, no outline
O: Outlined, shaded box

For types L, R, and C, PP-DATA contains the number of characters specified by PPH-LENGTH.  For all other types, PP-DATA is length zero (not specified).  For types L, R, and C, PP-STYLE is as follows:
F: Fixed pitch
P: Proportional space
D: Double size characters

void CSDisCreate::CompleteLine(char*Buffer)
This member function is a shortcut for creating a print image of a complete line.  It first calls the CSDisCreate::StartLine() function with the header character in Buffer[1].  It then calls CSDisCreate::Packet() the number of times specified by the PIC S99 USAGE COMP-5 in Buffer[0] with an argument starting at Buffer[2] for the first call and advancing appropriately for subsequent calls.  When complete, CSDisCreate::EndLine() is called.  If CSDisCreate::ReturnCode is set to non-zero by any of the called member functions, this function will return that code.  If the function is successful, CSDisCreate::ReturnCode will be zero.
int CSDisCreate::FileByte
This data member contains the size of the file in bytes.
int CSDisCreate::FileLine
This data member contains the size of the file in lines.
int CSDisCreate::FilePage
This data member contains the size of the file in pages.
int CSDisCreate::MaxPacket
This data member contains the maximum number of data packets in each page.
int CSDisCreate::MaxLine
This data member contains the maximum number of lines in each page.
int CSDisCreate::MaxByte
This data member contains the maximum number of bytes in each packet.
int CSDisCreate::PagePacket
This data member contains the number of packets in the current page.
int CSDisCreate::PageLine
This data member contains the number of lines in the current page.
int CSDisCreate::PageByte
This data member contains the number of bytes in the current page.
int CSDisCreate::LineByte
This data member contains the number of bytes in the current line.
short CSDisCreate::ReturnCode
This data member is set by the member functions to indicate success or failure.  It should be examined after every function call to insure the Standard Display text file has been properly created.
char CSDisCreate::FileStatus
This data member shows the state of the class as follows:
C: The output file is closed
O:The output file is opened
S:Output to the file is started
P:A page is started
L:A line is started


[ CBinaryFile | TCommandLineInfo | CCommaFile | TDateCtrl | CDDE | CDdeClient | CDdeServer ]
[ CDirectoryLocator | CDirectoryDialog | CDirectoryFind | CDirectoryNew | CFileCopy | TFrameWnd ]
[ InterfaceExcel | CMaintFn | CPrintFile | CProcDialog | TPrintDialog | CProcPropertyPage ]
[ CProgress | CRegistry | CSDisFile | CSDisPage | CSDisView | CTableFile ]
[ CTaskIcon | TPresent | TTime | TDate | TDateTime | CTransferData | TWinApp | CXlTable ]

[ Stand-alone Programs | Standard Library | Conversion Functions | Utility Functions | COBOL Functions ]
[ Windows NT Library | COBOL Library | COBOL Interface | Command Prompt Abbreviations | Purchase Instructions ]

[ Home | Areas of Expertise | "We Do Windows" | Clients and Projects | Software Samples | Package Software Available ]
[ Contact Information | Business Software Philosophy | Church Software Philosophy ]
All contents of this web site are Copyright © Titus Information Systems, Inc., Phoenix, Arizona, U.S.A.