Skip to content

Instantly share code, notes, and snippets.

@riferrei
Created October 10, 2011 15:33
Show Gist options
  • Save riferrei/1275616 to your computer and use it in GitHub Desktop.
Save riferrei/1275616 to your computer and use it in GitHub Desktop.
IDENTIFICATION DIVISION.
PROGRAM-ID. CSIMPSRV.
AUTHOR. TUXEDO DEVELOPMENT.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 TPSVCRET-REC.
COPY TPSVCRET.
*
01 TPTYPE-REC.
COPY TPTYPE.
*
01 TPSTATUS-REC.
COPY TPSTATUS.
*
01 TPSVCDEF-REC.
COPY TPSVCDEF.
01 LOGMSG.
05 FILLER PIC X(10) VALUE
"CSIMPSRV :".
05 LOGMSG-TEXT PIC X(50).
01 LOGMSG-LEN PIC S9(9) COMP-5.
01 RECV-STRING PIC X(100).
01 SEND-STRING PIC X(100).
*
LINKAGE SECTION.
*
PROCEDURE DIVISION.
*
START-FUNDUPSR.
MOVE LENGTH OF LOGMSG TO LOGMSG-LEN.
MOVE "Started" TO LOGMSG-TEXT.
PERFORM DO-USERLOG.
MOVE LENGTH OF RECV-STRING TO LEN.
CALL "TPSVCSTART" USING TPSVCDEF-REC
TPTYPE-REC
RECV-STRING
TPSTATUS-REC.
IF NOT TPOK
MOVE "TPSVCSTART Failed" TO LOGMSG-TEXT
PERFORM DO-USERLOG
PERFORM EXIT-PROGRAM
END-IF.
IF TPTRUNCATE
MOVE "Data was truncated" TO LOGMSG-TEXT
PERFORM DO-USERLOG
PERFORM EXIT-PROGRAM
END-IF.
INSPECT RECV-STRING CONVERTING
"abcdefghijklmnopqrstuvwxyz" TO
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".
MOVE "Success" TO LOGMSG-TEXT.
PERFORM DO-USERLOG.
SET TPSUCCESS TO TRUE.
COPY TPRETURN REPLACING
DATA-REC BY RECV-STRING.
DO-USERLOG.
CALL "USERLOG" USING LOGMSG
LOGMSG-LEN
TPSTATUS-REC.
EXIT-PROGRAM.
MOVE "Failed" TO LOGMSG-TEXT.
PERFORM DO-USERLOG.
SET TPFAIL TO TRUE.
COPY TPRETURN REPLACING
DATA-REC BY RECV-STRING.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment