IDENTIFICATION
DIVISION. 00010001
PROGRAM-ID. REC2TAB. 00020001
AUTHOR. SRIRAM. 00030001
*Move
records from PS to table
ENVIRONMENT
DIVISION. 00040001
INPUT-OUTPUT
SECTION. 00050001
FILE-CONTROL. 00060001
SELECT
PS ASSIGN TO
DD1 00061004
ORGANIZATION
SEQUENTIAL 00062004
ACCESS
IS
SEQUENTIAL 00063004
FILE
STATUS IS
WS-PS. 00064004
DATA
DIVISION. 00070001
FILE
SECTION. 00080001
FD
PS. 00081003
01
PS-REC. 00082003
02
PS-REGNO PIC
9(4). 00083003
02
FILLER PIC
X. 00084003
02
PS-NAME PIC
X(17). 00085003
02
FILLER PIC
X(2). 00086003
02
PS-COUNTRY PIC
X(5). 00087003
02
FILLER PIC
X. 00088003
02
PS-STATE PIC
X(13). 00089003
02
FILLER PIC
X(2). 00089103
02
PS-SALARY PIC
9(6). 00089203
02
FILLER PIC
X(29). 00089303
WORKING-STORAGE
SECTION. 00090001
01
WSS-ERR-MSG. 00100001
05
WS-ERR-MSG. 00110001
10
WS-ERR-LEN PIC
S9(4) COMP VALUE 800.00120001
10
WS-ERR-TEXT PIC
X(80) 00130001
OCCURS
10 TIMES. 00140001
05
WS-ERR-LRECL PIC
S9(9) COMP VALUE 80. 00150001
05
WS-DB2-ERRMSG-IDX PIC
9(2). 00160001
05
WS-ERROR-MESSAGE PIC
X(120). 00170001
05
WS-SQLCODE-CODE PIC
S9(3) 00180001
SIGN
LEADING SEPARATE.00190001
01
VARIABLES. 00199404
02
WS-PS PIC
9(2). 00199503
88
PS-SUCCESS VALUE
00. 00199603
88
PS-EOF VALUE
10. 00199703
01
DATES. 00199804
02
DATESS PIC
9(8). 00199908
02
TIMEE PIC
X(15). 00200004
02
EDIT-DATE
. 00200112
05
YEAR PIC
9(4). 00200208
05
FILL PIC
X VALUE '-'. 00200312
05
MONTH PIC
9(2). 00200408
05
FIL PIC
X VALUE '-'. 00200504
05
DDATE PIC
9(2). 00200608
01
WS-SQLCODE-ERR PIC
S9(03) 00201004
SIGN
LEADING SEPARATE.00210001
88
C01-IND-EM-SUCCESS VALUE
+000. 00220001
88
C01-IND-EM-DUPTABLE VALUE
-601. 00230001
88
C01-IND-EM-DB-NOT-FND VALUE
-204. 00240001
88
C01-IND-EM-ILLEGAL-SYMBOL VALUE
-104. 00250001
88
C01-IND-EM-ILLEGAL-KEYWORD VALUE
-199. 00260001
EXEC
SQL 00261003
INCLUDE
DEATAILS 00262003
END-EXEC 00263003
EXEC
SQL 00270001
INCLUDE
SQLCA 00280001
END-EXEC 00290001
PROCEDURE
DIVISION. 00300001
0000-MAIN-PARA. 00310001
PERFORM
1000-INITIALIZATION-PARA 00320001
THRU
1000-INITIALIZATION-PARA-EXIT 00330001
PERFORM
2000-PROCESS-PARA 00340001
THRU
2000-PROCESS-PARA-EXIT 00350001
UNTIL
PS-EOF 00351005
PERFORM
9000-TERMINATION-PARA 00360001
THRU
9000-TERMINATION-PARA-EXIT 00370001
. 00380001
0000-MAIN-PARA-EXIT. 00390001
EXIT 00400001
. 00410001
1000-INITIALIZATION-PARA. 00420001
INITIALIZE
WS-SQLCODE-ERR 00430001
. 00440001
1000-INITIALIZATION-PARA-EXIT. 00450001
EXIT 00460001
. 00470001
2000-PROCESS-PARA. 00480001
OPEN
INPUT
PS 00481007
READ
PS 00490003
EVALUATE
TRUE 00500003
WHEN
PS-SUCCESS 00510003
MOVE
PS-REGNO TO HV-EMPLOY-ID 00520003
MOVE
PS-NAME
TO HV-EMPLOY-FNAME-TEXT 00530003
MOVE
LENGTH OF HV-EMPLOY-FNAME-TEXT TO HV-EMPLOY-FNAME-LEN 00540003
MOVE
PS-COUNTRY TO HV-EMPLOY-COUNTRY 00640003
MOVE
PS-STATE TO
HV-EMPLOY-STATE 00641003
MOVE
PS-SALARY TO
HV-SALARY 00642003
MOVE
FUNCTION CURRENT-DATE TO
DATES 00643003
MOVE
DATESS(1:4) TO
YEAR 00644003
MOVE
DATESS(5:2) TO
MONTH 00645003
MOVE
DATESS(7:2) TO
DDATE 00646003
MOVE
'-' TO
FILL 00646112
MOVE
'-' TO
FIL 00646212
MOVE
EDIT-DATE TO
HV-DATEE 00647003
DISPLAY
EDIT-DATE 00647110
DISPLAY
DATESS 00647210
EXEC
SQL 00648003
INSERT
INTO 00649003
TB_CRICKET_PLAYERS_DETAILSS 00649103
VALUES 00649203
( 00649303
:HV-EMPLOY-ID 00649403
,:HV-EMPLOY-FNAME 00649503
,:HV-EMPLOY-COUNTRY 00649603
,:HV-EMPLOY-STATE 00649703
,:HV-SALARY 00649803
,:HV-DATEE 00649903
) 00650003
END-EXEC 00650103
WHEN
PS-EOF 00650205
DISPLAY
'END OF FILE
REACHED' 00650305
CLOSE
PS 00650406
PERFORM
9000-TERMINATION-PARA 00650506
THRU 9000-TERMINATION-PARA-EXIT 00650606
CONTINUE 00650705
WHEN
OTHER 00650805
DISPLAY
'READ
ERROR' 00650905
END-EVALUATE 00651005
MOVE
SQLCODE TO
WS-SQLCODE-ERR. 00652003
MOVE
SQLCODE TO
WS-SQLCODE-CODE. 00660003
EVALUATE
TRUE 00680003
WHEN
C01-IND-EM-SUCCESS 00690003
DISPLAY
'CREATED
SUCCESSFULSSSSS' 00700003
DISPLAY
WS-SQLCODE-CODE 00710003
WHEN
C01-IND-EM-DUPTABLE 00720001
DISPLAY
'THE TABLE NAME ALREADY
EXISTS' 00730001
DISPLAY
WS-SQLCODE-CODE 00740001
DISPLAY
SQLCODE 00750001
CALL
'DSNTIAR' USING
SQLCA, 00760001
,WS-ERR-MSG 00770001
,WS-ERR-LRECL 00780001
DISPLAY
WS-ERR-MSG 00790001
WHEN
C01-IND-EM-DB-NOT-FND 00800001
DISPLAY
'CHECK THE DATABASE NAME. IT IS NOT VALID' 00810001
DISPLAY
WS-SQLCODE-CODE 00820001
WHEN
C01-IND-EM-ILLEGAL-SYMBOL 00830001
DISPLAY
'CHECK THE BRACES,COMMA,AND SPELLINGS.INVALID'00840001
DISPLAY
WS-SQLCODE-CODE 00850001
WHEN
C01-IND-EM-ILLEGAL-KEYWORD 00860001
DISPLAY
'CHECK SPLELLINGS OF THE KEYWORDS.ITS INVALID'00870001
DISPLAY
WS-SQLCODE-CODE 00880001
WHEN
OTHER 00890001
CALL
'DSNTIAR' USING
SQLCA, 00900001
WS-ERR-MSG 00910001
WS-ERR-LRECL 00920001
DISPLAY WS-ERR-MSG 00930001
END-EVALUATE 00940001
. 00950001
2000-PROCESS-PARA-EXIT. 00960001
EXIT 00970001
. 00980001
9000-TERMINATION-PARA. 00990001
STOP
RUN 01000001
. 01010001
9000-TERMINATION-PARA-EXIT. 01020001
EXIT 01030001
. 01040001
No comments:
Post a Comment