|
|||||
|
The SimoMODS are a collection of shared modules that perform common tasks or repeatable processes for many different users. The SimoMODS are divided into two categories, callable modules and driver programs. The SimoMODS that are written in COBOL have been compiled with Micro Focus Net Express to create executable members. The executable members are intended for use in an ASCII-encoded environment and may be used with Net Express, Application Server or Enterprise Server running on a Microsoft Windows system.
Detailes information about each of the common or shared modules along with links for downloading may be found in the Downloads and Links to Similar Pages section of this document.
To quickly install and use the SimoMODS shared modules the following procedure is recommended.
| Step | Description |
| Step 1 | Create a new directory and make the new directory the current
directory using the following statements.c:\> MD SimoLIBR c:\> CD SimoLIBR c:\SimoLIBR> |
| Step 2 | Create three sub-directories under the SimoLIBR directory using
the following statements.c:\SimoLIBR> MD DataWrk1 c:\SimoLIBR> MD HTML c:\SimoLIBR> MD LOGS |
| Step 3 | Download the zPack for the executable members using the
following URL. http://www.simotime.com/sim4dzip.htm#COBOLRoutineDriversExec. |
| Step 4 | Unzip the contents of the execmods.zip file into the c: \SimoLIBR directory. |
| Step 5 | Add the SimoLIBR directory to the Windows PATH. |
After completing the preceding steps the SimoLIBR directory should contain the three sub-directories, the executable members, the COBOL copy files and a couple of command files(additional members may be in the SimoLIBR directory if other technologies have been downloaded from the SimoTime web site). To validate the proper installation execute the Ivp4NOTE.CMD file. This may be done from a command line window or by simply clicking on the item from a Windows Explorer display.
Note: Many of the examples and technologies available from SimoTime use the services provided by the SimoMODS drivers and callable routines.
SimoBITS is written and tested using the VS COBOL II dialect. Also, SimoBITS will work with COBOL for MVS and COBOL/370. A suite of sample programs that illustrate the use of the SimoBITS routine is provided on the SimoTime Web Site. SimoBITS may be compiled and executed on an IBM mainframe or as a project with Micro Focus Mainframe Express (MFE) or Net Express running on a PC with Windows (refer to http://www.microfocus.com ).
Determining and changing the setting of a bit within a byte is possible using COBOL. An assembler routine or the use of a language extension is not required. The called COBOL routine (SIMOBITS) in this example provides two functions.
The SimoBITS routine (or callable program) will convert the bit information in a single byte to or from an eight-byte field of COBOL accessible zeroes and ones.
The following will explain the two functions performed by the SimoBITS routine.
1. How to expand a single byte into eight bytes of 0's or 1's based on
the bit settings within the one byte field.
2. How to compress eight bytes
of 0's and 1's into a single byte of eight bits.
For each bit that is ON (1) in the BTS-PASS-BITS field the correspondong byte in the BTS-PASS-BYTES field is set to a value of one. For each bit that is OFF (0) in the BTS-PASS-BITS field the correspondong byte in the BTS-PASS-BYTES field is set to a value of zero.
| Input | BTS-PASS-BITS, a one byte field (8-bits) | |
| Output | BTS-PASS-BYTES, an eight byte field with zeroes and ones | |
| Example | if BTS-PASS-BITS = x'55' then BTS-PASS-BYTES will be '01010101' | |
For each byte that is a one in the BTS-PASS-BYTES field the correspondong bit in the BTS-PASS-BITS field is set to ON (1). For each byte that is zero in the BTS-PASS-BYTES field the correspondong bit in the BTS-PASS-BITS field is set to OFF (0).
| Input | BTS-PASS-BYTES, an eight byte field with zeroes and ones | |
| Output | BTS-PASS-BITS, a one byte field (8-bits) | |
| Example | if BTS-PASS-BYTES = '01010101' then BTS-PASS-BITS will be set to x'55' | |
The callable interface requires a data structure or pass area to be defined. A copy file (PASSBITS.CPY) is provided with the following source code.
*****************************************************************
* Data Structure or Pass Area used for calling SIMOBITS. *
*****************************************************************
* Copyright (C) 1987-2006 SimoTime Enterprises *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
*
* When BTS-PASS-REQUEST is 'EXPAND ' then
* BTS-PASS-BITS (a 1-btye field of 8-bits) is analyzed
* and based on the bit settings a corresponding value of
* 0 or 1 is set in the BTS-PASS-BYTES (an 8-byte field
* of zeroes and ones).
*
* When BTS-PASS-REQUEST is 'COMPRESS' then
* BTS-PASS-BYTES (an 8-byte field of zeroes and ones) is
* analyzed and based on a value of 0 or 1 the corresponding
* bit in BTS-PASS-BITS (a 1-byte field of 8-bits) is
* switched ON or OFF.
*
01 BTS-PASS-AREA.
05 BTS-PASS-REQUEST PIC X(8).
05 BTS-PASS-RESULT PIC S9(9) COMP.
05 BTS-PASS-RECORD.
10 BTS-PASS-BITS PIC X.
10 BTS-PASS-BYTES.
15 BTS-PASS-BYTE-01 PIC X.
15 BTS-PASS-BYTE-02 PIC X.
15 BTS-PASS-BYTE-03 PIC X.
15 BTS-PASS-BYTE-04 PIC X.
15 BTS-PASS-BYTE-05 PIC X.
15 BTS-PASS-BYTE-06 PIC X.
15 BTS-PASS-BYTE-07 PIC X.
15 BTS-PASS-BYTE-08 PIC X.
*! PASSBITS - End-of-Copy File...
The following will translate an eight character field of 0's and 1's to a one byte field with the bits set to match to 0's and 1's of the eight character field. Please note: the content of the BTS-PASS-REQUEST field must be upper case and contain 'COMPRESS'
*****************************************************************
* The coding required to do the call to the Byte-Bit Routine *
* (translate an 8-byte field to a 1-byte field). *
*****************************************************************
MOVE '11111111' to BTS-PASS-BYTES
MOVE 'COMPRESS' to BTS-PASS-REQUEST
CALL 'SIMOBITS' using BTS-PASS-AREA
In the preceding example the contents of BTS-PASS-BITS will be X'FF' or high-value upon return from the call to SIMOBITS.
The following will set the individual bytes of an eight character field to 0's or 1's based on the bit settings of a one byte field. Please note: the content of the BTS-PASS-REQUEST field must be upper case and contain 'EXPAND' followed by two spaces
*****************************************************************
* The coding required to do the call to the Byte-Bit Routine *
* (translate a 1-byte field to an 8-byte field). *
*****************************************************************
MOVE X'55' to BTS-PASS-BITS
MOVE 'EXPAND ' to BTS-PASS-REQUEST
CALL 'SIMOBITS' using BTS-PASS-AREA
In the preceding example the contents of BTS-PASS-BYTES will be '01010101' upon return from the call to SIMOBITS.
A source code listing for SimoBITS is available for viewing at http://www.simotime.com/simobits.htm. To download the Simoxxxx members or sample programs that use this callable member refer to the Downloads and Links to Similar Pages section of this document.
SimoBSIO is a callable routine that uses the Micro Focus Byte-Stream I/O capability to access a file. This routine may access a single byte or multiple bytes of data at the specified offset into the file. SimoBSIO is written and tested using the Micro Focus COBOL dialect (it will only execute in a Micro Focus environment, it will not compile and run on a mainframe system). A suite of sample programs that illustrate the use of the SimoBSIO routine is provided on the SimoTime Web Site. SimoBSIO may be compiled and executed using Micro Focus Net Express running on a PC with Microsift Windows (refer to http://www.microfocus.com ).
The callable interface requires a data structure or pass area to be defined. A copy file (PASSBSIO.CPY) is provided with the following source code.
The following is the syntax for calling the byte-stream I/O routine (SIMOBSIO.CBL).
call 'SIMOBSIO' using PSIO-PASS-AREA
A source code listing for SimoBSIO is available for viewing at http://www.simotime.com/simobsio.htm. To download the Simoxxxx members or sample programs that use this callable member refer to the Downloads and Links to Similar Pages section of this document.
The SimoCARD Series is a suite of callable routines that use the standard access methods provided by the COBOL programming language. The routines that access sequential files with 80-byte, fixed length records are written and tested using a COBOL dialect that is OS/390 compliant. The SimoCARD source members may be compiled and executed using Micro Focus COBOL (Net Express) running on a PC with Microsoft Windows (refer to http://www.microfocus.com ). A suite of sample programs that illustrate the use of the SimoCARD routines is provided on the SimoTime Web Site.
The SimoCARD Series includes the following programs
| Program Name | Description. |
| SIMOGR80 | This member provides "Read-Only" access to a Record Sequential file of 80-byte, fixed length records. |
| SIMOGL80 | This member provides "Read-Only" access to a Line Sequential file of 80-byte, fixed length records. |
| SIMOPR80 | This member provides "Write-Only" access to a Record Sequential file of 80-byte, fixed length records. |
| SIMOPL80 | This member provides "Write-Only" access to a Line Sequential file of 80-byte, fixed length records. |
| SIMOXT80 | This member provides translation between EBCDIC and ASCII for a dats buffer that is 80-bytes in length. |
The callable interface requires a data structure or pass area to be defined. A copy file is provided with the following source code.
The following is the syntax for calling a SimoCARD Series program.
call 'SIMOxxxx' using xxxx-PASS-AREA
where "xxxx" is GR80, GL80, PR80, PL80 or XT80.
A source code listing for SimoCARD is available for viewing at http://www.simotime.com/simocard.htm. To download the Simoxxxx members or sample programs that use this callable member refer to the Downloads and Links to Similar Pages section of this document.
This routine will edit the mm-dd-ccyy for reasonability of content and provide various date formats. The following is a list of the functions provided in this example.
| 1. | Accept Gregorian date as input. |
| 2. | Validate the month for 1-12 and create text string (i.e. month 7 is July). |
| 3. | Determine if the year is a leap year. |
| 4. | Vaildate the day for 1-30, 1-31, 1-28 or 1-29 based on month and leap year. |
| 5. | Create a text string for the date (i.e. 2002/01/01 is January 1, 2002) |
| 6. | Create a ccyyddd format for the date (i.e. 2002/04/01 is 2002092) |
| 7. | Calculate days remaining in the year. |
| 8. | Provide an edited Gregorian Date (I.e. 20020915 could be 2002-09-15) |
The callable interface requires a data structure or pass area to be defined. A copy file (PASSDATE.CPY) is provided with the following source code.
*****************************************************************
* Data Structure or Pass Area used for calling SIMODATE. *
*****************************************************************
* Copyright (C) 1987-2006 SimoTime Enterprises *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
* STD-REQUEST - This is an eight character data string
* and should contain the following in
* upper case.
* EDITDATE, This keyword causes the date
* routine (SIMODATE) to validate the date
* and provide and edited text string plus
* a julian date and more.
* The calling program must provide the
* above as a request. Otherwise, a non-
* zero return code will be set in the
* following result field. This data string
* is not changed by the date routine.
*
* STD-RESPONSE - This is a four byte binary data string
* and is used by the conversion routine to
* pass a return code. If the date request
* is successful the value in this data
* string will be zero.
*
* STD-MESSAGE-TEXT - If a non-zero response occurs this field
* will contain a short message.
*
* STD-GREGORIAN-4-EDIT - This is the input date field in
* gregorian format that will be vaidated.
* If the gregorian date does not pass the
* editing process a message will be posted
* in the STD-MESSAGE-TEXT field and a
* non-zero value of 16 will be placed in
* the STD-RESPONSE field. SimoDATE is
* somewhat flexible in accepting and
* reformatting a gregorian date. For
* example, the following are acceptable
* and will be reformatted into the
* STD-GREGORIAN-4-EDIT field.
* ccyymmdd This is the preferred format.
* ccyy-mm-dd Special characters may be
* used as separators.
* ccyy-m-d Single digit month and day
* values are acceptable when
* delimiter are used.
* ccyy/m/dd A mixing of single digit
* usage is accepted.
*
* STD-DEBUG-INFO - This data string provides additional
* debugging capability. This may be
* helpful if changes are made to the date
* routine.
*
* STD-LEAP-YEAR-YN - This field is used to identify a leap
* year. A "Y" indicates the input date is
* a leap year. An "N" indicates the input
* year is not a leap year.
*
* STD-MONTH-VERBAGE - This field is used for the text of the
* input month. For example, 1=January,
* 2=February, etc.
*
* STD-MM-DAYS - This field is used for the number of
* days in the input month.
*
* STD-GREGORIAN-DATE - This field is used for the gregorian
* date in ccyymmdd format (all numeric
* values).
*
* STD-JULIAN-DATE - This field is used for the julian date
* in ccyyddd format.
*
* STD-DAYS-REMAINING - The number of days remaining in the
* year.
*
* STD-DATE-VERBAGE - This field is used for the date in text
* format. For example, 19991225 will
* produce a text string of
* December 25, 1999.
*
* STD-DATE-EDIT-BYTE - This field contains the character that
* will be used to edit and format the
* gregorian date. For example, this field
* may contain a space, a dash, a slash,
* etc... and will be used as the delimiter
* between the year, month and day.
*
* STD-DATE-EDITED - This field if for the edited date using
* the delimiter character from the
* preceding field. For example, 19991225
* will produce 1999/12/25 if the delimiter
* character is a slash.
*****************************************************************
*
01 STD-SIMODATE.
05 STD-REQUEST pic X(8).
05 STD-RESPONSE pic 9(4).
05 STD-MESSAGE-TEXT pic X(68).
05 STD-GREGORIAN-4-EDIT pic X(10).
05 STD-EDITED-INFO.
10 STD-DEBUG-INFO pic X(8).
10 STD-LEAP-YEAR-YN pic X.
10 STD-MONTH-VERBAGE pic X(10).
10 STD-MM-DAYS pic 99.
10 STD-GREGORIAN-DATE pic 9(8).
10 STD-JULIAN-DATE pic 9(7).
10 STD-JULIAN-VALUE redefines STD-JULIAN-DATE.
15 STD-JULIAN-CCYY pic 9(4).
15 STD-JULIAN-DAY pic 9(3).
10 STD-DAYS-REMAINING pic 9(3).
10 STD-DATE-VERBAGE pic X(18).
10 STD-DATE-EDIT-BYTE pic X.
10 STD-DATE-EDITED pic X(10).
*! PASSDATE - End-of-Copy File...
The following is the syntax for calling the date routine (SIMODATE.CBL).
call 'SIMODATE' using STD-SIMODATE
A source code listing for SimoDATE is available for viewing at http://www.simotime.com/simodate.htm. To download the Simoxxxx members or sample programs that use this callable member refer to the Downloads and Links to Similar Pages section of this document.
This routine will display the contents of a field in hexadecimal format with the EBCDIC and ASCII translation where possible. Also, the information may be written to a log file or simply passed back to the calling program. The format of the dump information is intended for use when dumping the contents of memory or WORKING-STORAGE. The format of the SimoHEX4 routine routine may be better suited for dumping data file records.
The following shows the format for the output of the SimoDUMP routine.
* SIMODUMP COBOL Hexadecimal Dump Routine v03.01.24 http://www.simotime.com * SIMODUMP Copyright 1987-2006 SimoTime Enterprises, LLC All Rights Reserved * DISPLAY1 Starting... Length = 0026 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 C1C2C3C4 C5C6C7C8 C9D1D2D3 D4D5D6D7 ABCDEFGHIJKLMNOP ................ * 17-032 D8D9E2E3 E4E5E6E9 E8E9xxxx xxxxxxxx QRSTUVWZYZ...... ................ * DISPLAY1 Complete... Length = 0026
The callable interface requires a data structure or pass area to be defined. A copy file (PASSDUMP.CPY) is provided with the following source code.
*****************************************************************
* Data Structure or Pass Area used for calling SIMODUMP. *
*****************************************************************
* Copyright (C) 1987-2006 SimoTime Enterprises *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* *
*****************************************************************
* Values for SIMODUMP-REQUEST *
* DUMP Dump the Buffer in Heaxedecimal format *
* NOTE Display or Write the text to the screen or log file *
* *
* Values for SIMODUMP-SYSOUT *
* SHOW Display dump information on screen *
* FILE Write dump information to the log file (SYSLOG) *
* BOTH Display to screen and write to log file *
* NONE Do not output to screen or file, put dump info in *
* pass area table and return to caller. *
*****************************************************************
01 SIMODUMP-PASS-AREA.
* Initial information is provided by the calling program,
* The SIMODUMP-REQUEST field will be modified to "DUMP" if it
* does not contain a valid entry.
* The SIMODUMP-RESULT field may also be modified by the
* SimoDUMP routine.
05 SIMODUMP-REQUEST PIC X(4).
05 SIMODUMP-RESULT PIC 9999.
* The following are not modified by the SimoDUMP routine...
05 SIMODUMP-DUMP-ID PIC X(8).
05 SIMODUMP-SYSOUT PIC X(4).
05 SIMODUMP-COPYRIGHT PIC X(4).
05 SIMODUMP-LENGTH PIC 9999.
05 SIMODUMP-BUFFER PIC X(128).
* The following are modified by the SimoDUMP routine...
05 SIMODUMP-IDX PIC 99.
05 SIMODUMP-LINES PIC X(80) OCCURS 8 TIMES.
*! PASSDUMP - End-of-Copy File...
A source code listing for SimoDUMP is available for viewing at http://www.simotime.com/simodump.htm. To download this member or other Simoxxxx members or sample programs that use this callable member refer to the Downloads and Links to Similar Pages section of this document.
This is a driver program used with Micro Focus Net Express running on a Windows platform on a Personal Computer. Quite often the COBOL programs may be ported from an IBM Mainframe and were executed from a JCL (Job Control Language) script that passed a parameter. Also, the ability to write to a log file may be required as a replacement for the mainframe spool file function that shows the start, stop and status of the completed or abended job. The following is a sample of the logging or tracking information.
2004/01/20 16:08:32:13 *******************************************************StaMlrE2 2004/01/20 16:08:32:23 Starting JobName StaMlrE2 2004/01/20 16:08:32:33 Identify JobStep StaMlrS1, Set Globals, Delete Previous Files 2004/01/20 16:08:32:46 Identify JobStep StaMlrS2, Extract non-PO Boxes 2004/01/20 16:08:32:55 Starting Program STAMLRC1, parm=NOPOBOX 2004/01/20 16:08:32:74 Finished Program STAMLRC1, RC=0000 2004/01/20 16:08:32:84 Produced DataSet d:\simoNXE4\AN01\datawrk1\MAILTEMP.TXT 2004/01/20 16:08:32:94 Identify JobStep StaMlrS3, Sort by Postal Code 2004/01/20 16:08:33:03 Starting Program CblSrtC1 2004/01/20 16:08:33:12 Finished Program CblSrtC1, RC=0000 2004/01/20 16:08:33:21 Produced DataSet d:\simoNXE4\AN01\datawrk1\MAILSORT.TXT 2004/01/20 16:08:33:31 Identify JobStep StaMlrS4, Create four across labels 2004/01/20 16:08:33:42 Starting Program STAMLRC2 2004/01/20 16:08:33:48 Finished Program STAMLRC2, RC=0000 2004/01/20 16:08:33:58 Produced DataSet d:\SimoNXE4\AN01\DataWrk1\MAILTEXT.TXT 2004/01/20 16:08:33:68 Finished JobName StaMlrE2
The SimoEXEC program will access the command line and process the following requests.
| SIMOEXEC EXEC program-name |
| The preceding statement will
perform the following 1. Write the start-time information to the log file. 2. Call the specified program. 3. Write the stop-time and completion information to log file. |
| SIMOEXEC EXEC program-name PARM=parameter |
| The preceding statement will
perform the following 1. Write the start-time information to the log file. 2. Call the specified program and pass the parameter. 3. Write the stop-time and completion information to log file. Note: Two parameters are actually passed to the called program. This first parameter is a two-byte, binary value that is the length of the parameter. The second parameter is the parameter itself. This format maps to the format of the mainframe when a program is executed using the PARM= function of the EXEC statement of JCL (Job Control Language). |
| SIMOEXEC EXEC SORT |
| 1. Wrtie the start-time
information to the log file. 2. Perform the sort using MFSORT 3. Write the stop-time and completion information to log file. |
| SIMOEXEC NOTE message-text |
| Write the message-text preceded by a date and time stamp to the log file. |
Please note that programs with a STOP RUN will terminate the process without logging.
A source code listing for SimoEXEC is available for viewing at http://www.simotime.com/simoexec.htm. To download the Simoxxxx members or sample programs that use this driver program refer to the Downloads and Links to Similar Pages section of this document.
This routine will display the contents of a field in hexadecimal format with the EBCDIC and ASCII translation where possible. Also, the information may be written to a log file or simply passed back to the calling program. The format of the dump information is intended for use when dumping the contents of data file records. Tthe format of the SimoDUMP routine may be better suited for dumping memory or WORKING-STORAGE.
The following shows the format for the output of the SimoHEX4 routine that was executed in an ASCII environment..
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 I am record 005 of TXTHEXT1.TXT - *.Tab01.Tab02.tab03 4266276667623332662555445532555222205663305663307663322222222222222222222222222 901D0253F2400050F6048485841E4840D0A94120194120294120300000000000000000000000000 ../_....?.......?..................../...../...../.............................
The following shows the format for the output of the SimoHEX4 routine that was executed in an EBCDIC environment..
* TXTHEXC1 HEX-Dump of TEXT Data Set v04.01.14 http://www.simotime.com * TXTHEXC1 Copyright 1987-2006 SimoTime Enterprises, LLC All Rights Reserved ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 .@..@......@...@..@........K...@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ C48949889984FFF4984EEECCEEF4EEE444444444444444444444444444444444444444444444444 901409536940001066037385731B373000000000000000000000000000000000000000000000000 I am record 001 of TXTHEXT1.TXT
The callable interface requires a data structure or pass area to be defined. A copy file (PASSHEX4.CPY) is provided with the following source code.
*****************************************************************
* Data Structure or Pass Area used for calling SIMOHEX4. *
*****************************************************************
* Copyright (C) 1987-2006 SimoTime Enterprises *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
* PASSHEX4-REQUEST - This must contain the following value. *
* DUMP, Dump Buffer in Hexadecimal format. *
* PASSHEX4-RESULT - Zero indicates a successful completion. *
* Non-Zero indicates a failure in processing *
* the request. *
* PASSHEX4-LENGTH - Specifies the length of the text strings *
* for the PASSHEX4-SOURCE. If the length
* exceeds 1024 then it will be reset to 128. *
* PASSHEX4-SOURCE - This is the input field for the SimoHEX4 *
* routine. This field will not be modified. *
* The contents will be translated into a *
* haxadecimal format and the results of the *
* translation will be placed in the *
* following fields. *
* PASSHEX4-ASCII - This is a translation of possible ASCII. *
* PASSHEX4-UPPER - This is leftmost (or high order) nibble. *
* PASSHEX4-LOWER - This is rightmost (or low order) nibble. *
* PASSHEX4-EBCDIC - This is a translation of possible EBCDIC. *
*****************************************************************
01 PASSHEX4-PASS-AREA.
* The following are provided by the calling program,
05 PASSHEX4-REQUEST PIC X(4).
* The PASSHEX4-RESULT may be modified by SimoHEX4...
05 PASSHEX4-RESULT PIC 9(4).
05 PASSHEX4-LENGTH PIC 9(5).
05 PASSHEX4-SOURCE PIC X(1024).
* The following are modified by SimoHEX4...
05 PASSHEX4-DUMP-INFO.
10 PASSHEX4-ASCII PIC X(1024).
10 PASSHEX4-UPPER PIC X(1024).
10 PASSHEX4-LOWER PIC X(1024).
10 PASSHEX4-EBCDIC PIC X(1024).
*! PASSHEX4 - End-of-Copy File...
A source code listing for SimoDUMP is available for viewing at http://www.simotime.com/simohex4.htm. To download this member or other Simoxxxx members or sample programs that use this callable member refer to the Downloads and Links to Similar Pages section of this document.
This program provides an example of how to justify or position a text string within a field. The example shows how to do the following.
| 1. | Center a text string in a field. |
| 2. | Right justify a text string within a field. |
| 3. | Left justify a text string within a field. |
The callable interface requires a data structure or pass area to be defined. A copy file (PASSJUST.CPY) is provided with the following source code.
*****************************************************************
* Data Structure or Pass Area used for calling SIMOJUST. *
*****************************************************************
* Copyright (C) 1987-2006 SimoTime Enterprises *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
01 JUST-PASS-AREA.
05 JUST-REQUEST PIC X(8).
05 JUST-RESPOND PIC 9(4).
05 JUST-SOURCE PIC X(60).
05 JUST-TARGET PIC X(60).
*! PASSJUST - End-of-Copy File...
A source code listing for SimoJUST is available for viewing at http://www.simotime.com/simojust.htm. To download the Simoxxxx members or sample programs that use this callable member refer to the Downloads and Links to Similar Pages section of this document.
This program provides an example of how to display text messages to the screen and write the information to a log file. When the text message is written to a log file it is preceded by a date and time stamp.
The callable interface requires a data structure or pass area to be defined. A copy file (PASSLOGS.CPY) is provided with the following source code.
*****************************************************************
* Data Structure or Pass Area used for calling SIMOLOGS. *
*****************************************************************
* Copyright (C) 1987-2006 SimoTime Enterprises *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
* SIMOLOGS-REQUEST Type of request, must be one of the *
* following values. *
* BOTH - Display message on the console, *
* Write message to the SYSLOG file. *
* FILE - Write message to the SYSLOG file. *
* NOTE - Display message on the console, *
* Write message to the SYSLOG file. *
* SHOW - Display message on the console. *
* SIMOLOGS-STATUS This is an indicator as to the success *
* or failure of the request. A value of *
* zero (0000) indicates the routine was *
* successful. A non-zero value indicates *
* a failure. *
* SIMOLOGS-MESSAGE Contains the message text. *
*****************************************************************
01 SIMOLOGS-PASS-AREA.
05 SIMOLOGS-REQUEST pic X(4).
05 SIMOLOGS-STATUS pic 9999.
05 SIMOLOGS-MESSAGE pic X(1024).
*! PASSLOGS - End-of-Copy File...
Note: The maximum length for the message text is 1,024 characters.
A source code listing for SimoLOGS is available for viewing at http://www.simotime.com/simologs.htm. To download the Simoxxxx members or sample programs that use this callable member refer to the Downloads and Links to Similar Pages section of this document.
This Windows Command File may be called from other command files and will display a string of message text to the screen and write to a log file in a consistent, predefined format. The log file function provides a way to review the results of running a command file that was scheduled and executed in an unattended environment. Prior to writing a message to the log file a date and time stamp is inserted in front of the message text. This command file is intended to be called by other command files and used in the Microsoft Windows environment
The call interface is as follows.
call SimoNOTE "This is my message..."
The message text that is between the double quotes will be displayed to the screen and wriiten to a log file. The log file name and location may be defined by setting the SimoNOTE environment variable as shown in the following example. If the SimoNOTE environment variable is not set then the default is to write to the following log file.
set SimoNOTE=c:\SimoLIBR\LOGS\SimoTime.LOG
The following (IVP4NOTE.CMD) is the source code for the Installation Verification Procedure.
@echo OFF
rem * *******************************************************************
rem * This program is provided by: *
rem * SimoTime Enterprises, LLC *
rem * (C) Copyright 1987-2006 All Rights Reserved *
rem * Web Site URL: http://www.simotime.com *
rem * e-mail: helpdesk@simotime.com *
rem * *******************************************************************
rem *
rem * Text - Installation Verification Program (IVP) for SimoNOTE.CMD.
rem * Author - SimoTime Enterprises
rem *
rem * This command line script will display messages to the screen and
rem * write the messages to a log file. This script will call SimoNOTE
rem * to do the actual display and write to the log file.
rem *
rem * Note: the message text must be enclosed in double quotes. This
rem * will allow embedded spaces in the message text. If the
rem * double quotes are not used the message will be truncated
rem * after the first space character.
rem *
rem * Note: prior to writing to the log file the SimoNOTE procedure
rem * will insert a date and time stamp at the front of the
rem * message text.
rem *
setlocal
set SimoNOTE=c:\SimoLIBR\LOGS\Ivp4NOTE.TXT
if exist %SimoNOTE% erase %SimoNOTE%
rem *
call SimoNOTE "*******************************************************Ivp4NOTE"
call SimoNOTE "Starting JobName Ivp4NOTE, User is %USERNAME%"
rem *
call SimoNOTE "Executing the Installation Verification Procedure for SIMONOTE"
rem *
call SimoNOTE "Conclude The log file is %SimoNOTE%"
rem *
call SimoNOTE "Finished JobName Ivp4NOTE, User is %USERNAME%"
if not "%1" == "nopause" start NotePAD %SimoNOTE%
endlocal
if not "%1" == "nopause" pause
A source code listing for SimoNOTE and additional information on usage is available for viewing at http://www.simotime.com/simonote.htm. To download the SimoMODS shared modules or sample programs that use this callable shared modules refer to the Downloads and Links to Similar Pages section of this document.
This program provides an example of how to parse keywords within a field and then access each keyword using the "Reference Modification" feature of the COBOL language.
The callable interface requires a data structure or pass area to be defined. A copy file (PASSPARS.CPY) is provided with the following source code.
*****************************************************************
* Data Structure used for calling SIMOPARS. *
*****************************************************************
* Copyright (C) 1987-2006 SimoTime Enterprises *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
* *
* PRS-REQUEST Type of request, must be zero (0) for *
* parsing. This item is provided by the *
* calling program and is not modified *
* by the parsing routine. *
* PRS-STATUS This is an indicator as to the success *
* or failure of the request. A value of *
* zero (0000) indicates the routine was *
* successful. A non-zero value indicates *
* a failure. *
* *
* ------------------------------------------------------------- *
* The following fields are provided by the calling routine. *
* *
* PRS-DELIMITER This is a one byte character that is *
* used as a delimiter. This item is *
* provided by the calling program and *
* is not modified by the parsing routine. *
* *
* PRS-KEEP-NULL-FIELDS This must be a Yes (Y) or No (N) value *
* (Y) will indicate a Yes, keep null field *
* (N) will indicate a No and null fields *
* will be dropped. *
* PRS-SUSPEND This must be a Yes (Y) or No (N) value *
* to indicate that the suspend/resume *
* function of checking for a delimiter *
* is active. *
* PRS-SUSPEND-BYTE If the previous parameter is (Y) this *
* byte will be used to suspend or resume *
* the testing for a delimiter charcter. *
* PRS-TERMINATOR This must be a Yes (Y) or No (N) value *
* to indicate a character that will be *
* used for termination of the parsing. *
* If (Y) then the next parameter is used *
* as a termination character. If (N) the *
* buffer will be parsed according to the *
* size of the buffer or maximum number *
* of table entries. This item is provided *
* by the calling program and is not *
* modified by the parsing routine. *
* PRS-TERMINATOR-BYTE If the previous parameter is (Y) this *
* byte will be used to terminate the *
* parsing when it is encountered in the *
* data string. This item is provided by *
* the calling program and is not modified *
* by the parsing routine. *
* *
* PRS-BUFFER-SIZE The size of the data string to be *
* parsed and must be a value of 1-1024. *
* This item is provided by the calling *
* program and is not modified by the *
* parsing routine. *
* PRS-BUFFER This is the data string or field that *
* will be parsed. This item is provided *
* by the calling program and is not *
* modified by the parsing routine. *
* *
* PRS-TABLE-MAX The maximum number of table entries *
* available for the POSITION/SIZE values *
* of the words in the input buffer. *
* This item is provided by the calling *
* program and is not modified by the *
* parsing routine. *
* *
* ------------------------------------------------------------- *
* The following fields are updated by the parsing routine. *
* *
* PRS-NUMBER-OF-ITEMS This is the number of keywords found *
* in the input data string. This item is *
* provided by the parsing routine. *
* *
* PRS-LAST-SIG-BYTE This is the position of the last *
* significant, non-delimiter byte. If the *
* PRS-TERMINATOR is "Y" this will be the *
* last significant byte before the *
* terminator byte. *
* *
* PRS-POSITION This is a table of 64 elements of *
* 4-bytes. The value is either zero (0) *
* or the position of a keyword within the *
* input data string. The first position *
* within the buffer is one (1). *
* This item is provided by the parsing *
* routine. *
* PRS-SIZE This is a table of 64 elements of *
* 4-bytes. The value is either zero (0) *
* or the size of a keyword within the *
* input data string. This item is provided *
* by the parsing routine. *
* *
* ------------------------------------------------------------- *
* NOTE... The table element number is the number *
* of the word within the data buffer. *
* The data buffer is PRS-BUFFER. *
* For example, PRS-POSITION(1) would point *
* to the position of the first character *
* of the first word in the data buffer *
* PRS-SIZE(1) would specify the number of *
* characters in the first word. *
* *
*****************************************************************
01 PRS-PARAMETERS.
05 PRS-REQUEST PIC X VALUE '0'.
05 PRS-STATUS PIC 9(4).
*! Provided by the calling program...
05 PRS-DELIMITER PIC X VALUE SPACE.
05 PRS-KEEP-NULL-FIELDS PIC X VALUE 'N'.
05 PRS-SUSPEND PIC X VALUE 'N'.
05 PRS-SUSPEND-BYTE PIC X VALUE SPACE.
05 PRS-TERMINATOR PIC X VALUE 'N'.
05 PRS-TERMINATOR-BYTE PIC X VALUE SPACE.
05 PRS-BUFFER-SIZE PIC 9(4) VALUE 1024.
05 PRS-BUFFER PIC X(1024).
05 PRS-TABLE-MAX PIC 9(4) VALUE 64.
*! Updated by the parsing routine...
05 PRS-NUMBER-OF-ITEMS PIC 9(4) VALUE 0.
05 PRS-LAST-SIG-BYTE PIC 9(4) VALUE 0.
05 PRS-POSITION OCCURS 64 TIMES
PIC 9(4) VALUE 0.
05 PRS-SIZE OCCURS 64 TIMES
PIC 9(4) VALUE 0.
*! PASSPARS - End-of-Copy File...
A source code listing for SimoSUB1 is available for viewing at http://www.simotime.com/simopars.htm. To download the Simoxxxx members or sample programs that use this callable member refer to the Downloads and Links to Similar Pages section of this document.
This program provides an example of how to right-adjust and zero fill a string of digits within a field..
The callable interface requires a data structure or pass area to be defined. A copy file (PASSRA12.CPY) is provided with the following source code.
*****************************************************************
* Data Structure or Pass Area used for calling SIMORA12. *
*****************************************************************
* Copyright (C) 1987-2006 SimoTime Enterprises *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
01 RA12-PASS-AREA.
05 RA12-REQUEST PIC X(8).
05 RA12-RESPOND PIC 9(4).
05 RA12-BUFFER.
10 RA12-NUMBER PIC 9(12).
*! PASSRA12 - End-of-Copy File...
A source code listing for SimoRA12 is available for viewing at http://www.simotime.com/simora12.htm. To download the Simoxxxx members or sample programs that use this callable member refer to the Downloads and Links to Similar Pages section of this document.
This program provides an example of how to access and display a File Status Code after an attempted file access in a COBOL program.
The callable interface requires a data structure or pass area to be defined.
The following statements are used to call the file status conversion routine.
move '35' to FSPA-STATUS-CODE-02
call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
Upon return from the call to SIMOSTAT the contents of the fields in the pass area will contain the following information.
FSPA-STATUS-CODE-02 = 35 FSPA-STATUS-CODE-04 = 0035 FSPA-TEXT-MESSAGE = 0035, OPEN failure, specified file not found
A copy file (PASSSTAT.CPY) defines the fields within the pass area.
01 FILE-STATUS-PASS-AREA.
05 FSPA-STATUS-CODE-02 PIC X(2).
05 FSPA-STATUS-CODE-04 PIC X(4).
05 FSPA-TEXT-MESSAGE PIC X(80).
A second copy file (TAB4STAT.CPY) is provided that contains a table of File Status Codes with a brief description.
A source code listing for SimoSUB1 is available for viewing at http://www.simotime.com/simostat.htm. To download the Simoxxxx members or sample programs that use this callable member refer to the Downloads and Links to Similar Pages section of this document.
This program provides an example of how to replace a text string within a fixed-length field with a text string of a different length.