Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 000001 IDENTIFICATION DIVISION.
- 000002 PROGRAM-ID. SEQINS.
- 000003 ENVIRONMENT DIVISION.
- 000004 INPUT-OUTPUT SECTION.
- 000005 FILE-CONTROL.
- 000006 SELECT INFILE ASSIGN TO RECSIN.
- 000007 DATA DIVISION.
- 000008 FILE SECTION.
- 000009 FD INFILE.
- 000010 01 INREC PIC X(80).
- 000011
- 000012 WORKING-STORAGE SECTION.
- 000013 EXEC SQL
- 000014 INCLUDE BEDG
- 000015 * INCLUDE BEDTYPG
- 000016 * INCLUDE ROOMG
- 000017 END-EXEC
- 000018 EXEC SQL
- 000019 * INCLUDE BEDG
- 000020 INCLUDE BEDTYPG
- 000021 * INCLUDE ROOMG
- 000022 END-EXEC
- 000023 EXEC SQL
- 000024 * INCLUDE BEDG
- 000025 * INCLUDE BEDTYPG
- 000026 INCLUDE ROOMG
- 000027 END-EXEC
- 000028 EXEC SQL
- 000029 INCLUDE SQLCA
- 000030 END-EXEC
- 000031 01 WS-VARS.
- 000032 02 NUMTRUN PIC X(50).
- 000033 02 ALPHANUM PIC X(8).
- 000034 02 ALPHANUM2 PIC X(8).
- 000035 02 ALPHANUM3 PIC X(8).
- 000036 02 ALPHANUM4 PIC X(8).
- 000037 02 BUFNUM PIC X(8).
- 000038 02 STRINGF PIC X(50).
- 000039 02 BEDV PIC X(50) VALUE "BED".
- 000040 02 BEDTYPEV PIC X(50) VALUE "BED-TYPE".
- 000041 02 ROOMV PIC X(50) VALUE "ROOM".
- 000042 01 F-CTR PIC 9(1).
- 000043 88 EOF VALUE 1.
- 000044 01 L-CTR PIC 9(1).
- 000045 88 BLLINE VALUE 1.
- 000046 88 NBL VALUE 0.
- 000047 01 EMPLINE PIC X(50) VALUE SPACES.
- 000048
- 000049 PROCEDURE DIVISION.
- 000050 MAIN.
- 000051 OPEN INPUT INFILE
- 000052 READ INFILE
- 000053 AT END SET EOF TO TRUE
- 000054 END-READ
- 000055 PERFORM UNTIL EOF
- 000056 DISPLAY INREC
- 000057 MOVE INREC TO NUMTRUN
- 000058 DISPLAY NUMTRUN
- 000059 EVALUATE TRUE
- 000060 WHEN BEDV = NUMTRUN
- 000061 PERFORM BED
- 000062 WHEN BEDTYPEV = NUMTRUN
- 000063 PERFORM BEDTP
- 000064 WHEN ROOMV = NUMTRUN
- 000065 PERFORM ROOM
- 000066 WHEN OTHER
- 000067 DISPLAY "INVALID CODE ENTERED"
- 000068 STOP RUN
- 000069 END-EVALUATE
- 000070 END-PERFORM
- 000071 CLOSE INFILE
- 000072 STOP RUN
- 000073 .
- 000074 BED.
- 000075 DISPLAY "IN LOOP BED"
- 000076 SET NBL TO TRUE
- 000077 READ INFILE
- 000078 AT END SET EOF TO TRUE
- 000079 END-READ
- 000080 PERFORM UNTIL EOF OR BLLINE
- 000081 MOVE INREC TO NUMTRUN
- 000082 IF NUMTRUN EQUAL TO EMPLINE THEN
- 000083 SET BLLINE TO TRUE
- 000084 ELSE
- 000085 UNSTRING INREC DELIMITED BY "," INTO
- 000086 ALPHANUM ALPHANUM2 ALPHANUM3 ALPHANUM4
- 000087 COMPUTE BBED-NUMBER = FUNCTION NUMVAL(ALPHANUM)
- 000088 COMPUTE BBED-AVAILABILITY =
- 000089 FUNCTION NUMVAL(ALPHANUM2)
- 000090 COMPUTE BROOM-ID = FUNCTION NUMVAL(ALPHANUM3)
- 000091 COMPUTE BBED-TYPE-ID = FUNCTION NUMVAL(ALPHANUM4)
- 000092 DISPLAY BBED-NUMBER ":" BBED-AVAILABILITY
- 000093 ":" BROOM-ID ":" BBED-TYPE-ID
- 000094 DISPLAY ALPHANUM4
- 000095 EXEC SQL
- 000096 INSERT INTO HOG0009.BED VALUES (:BBED-NUMBER,
- 000097 :BBED-AVAILABILITY, :BROOM-ID,
- 000098 :BBED-TYPE-ID)
- 000099 END-EXEC
- 000100 PERFORM SQLDEB
- 000101 EXEC SQL
- 000102 COMMIT
- 000103 END-EXEC
- 000104 PERFORM SQLDEB
- 000105 END-IF
- 000106 READ INFILE
- 000107 AT END SET EOF TO TRUE
- 000108 END-READ
- 000109 END-PERFORM
- 000110 .
- 000111 BEDTP.
- 000112 SET NBL TO TRUE
- 000113 DISPLAY "IN LOOP BEDTYPE"
- 000114 READ INFILE
- 000115 AT END SET EOF TO TRUE
- 000116 END-READ
- 000117 PERFORM UNTIL EOF OR BLLINE
- 000118 MOVE INREC TO NUMTRUN
- 000119 IF NUMTRUN EQUAL TO EMPLINE THEN
- 000120 SET BLLINE TO TRUE
- 000121 ELSE
- 000122 UNSTRING INREC DELIMITED BY "," INTO
- 000123 ALPHANUM
- 000124 BTBED-DESCRIPTION-TEXT
- 000125 MOVE 50 TO BTBED-DESCRIPTION-LEN
- 000126 COMPUTE BTBED-TYPE-ID = FUNCTION NUMVAL-C(ALPHANUM)
- 000127 DISPLAY BTBED-TYPE-ID ":" BTBED-DESCRIPTION
- 000128 EXEC SQL
- 000129 INSERT INTO HOG0009.BED_TYPE VALUES
- 000130 (:BTBED-TYPE-ID,
- 000131 :BTBED-DESCRIPTION)
- 000132 END-EXEC
- 000133 PERFORM SQLDEB
- 000134 EXEC SQL
- 000135 COMMIT
- 000136 END-EXEC
- 000137 PERFORM SQLDEB
- 000138 END-IF
- 000139 READ INFILE
- 000140 AT END SET EOF TO TRUE
- 000141 END-READ
- 000142 END-PERFORM
- 000143 .
- 000144 ROOM.
- 000145 DISPLAY "IN LOOP ROOM"
- 000146 SET NBL TO TRUE
- 000147 READ INFILE
- 000148 AT END SET EOF TO TRUE
- 000149 END-READ
- 000150 PERFORM UNTIL EOF OR BLLINE
- 000151 MOVE INREC TO NUMTRUN
- 000152 IF NUMTRUN EQUAL TO EMPLINE THEN
- 000153 SET BLLINE TO TRUE
- 000154 ELSE
- 000155 UNSTRING INREC DELIMITED BY "," INTO
- 000156 ALPHANUM
- 000157 STRINGF
- 000158 COMPUTE RROOM-ID = FUNCTION NUMVAL(ALPHANUM)
- 000159 MOVE STRINGF TO RROOM-DESCRIPTION-TEXT
- 000160 MOVE 50 TO RROOM-DESCRIPTION-LEN
- 000161 DISPLAY RROOM-ID ":" RROOM-DESCRIPTION
- 000162 EXEC SQL
- 000163 INSERT INTO HOG0009.ROOM VALUES
- 000164 (:RROOM-ID,
- 000165 :RROOM-DESCRIPTION)
- 000166 END-EXEC
- 000167 PERFORM SQLDEB
- 000168 EXEC SQL
- 000169 COMMIT
- 000170 END-EXEC
- 000171 PERFORM SQLDEB
- 000172 END-IF
- 000173 READ INFILE
- 000174 AT END SET EOF TO TRUE
- 000174 AT END SET EOF TO TRUE
- 000175 END-READ
- 000176 END-PERFORM
- 000177 .
- 000178 SQLDEB.
- 000179 DISPLAY "SQLCODE: " SQLCODE
- 000180 DISPLAY "REASON: " SQLERRMC
- 000181 DISPLAY "WARING: " SQLWARN
- 000182 EVALUATE SQLCODE
- 000183 WHEN 0
- 000184 DISPLAY 'SUCCESFULL'
- 000185 WHEN +100
- 000186 DISPLAY 'CANNOT FIND ROW'
- 000187 WHEN OTHER
- 000188 DISPLAY 'UNKNOWN ERROR'
- 000189 END-EVALUATE
- 000190 .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement