Tags

, , , , , ,

1. CONSIDER THE BELOW PART FROM A SOURCE CODE.

WORKING-STORAGE SECTION.

01 WS-ARRAY-VAR.
05 WS-ARRAY PIC X(1) OCCURS 5 TIMES.

01 WS-VAR PIC 9(1).

PROCEDURE DIVISION.

PERFORM VARYING WS-VAR FROM 1 BY 1 UNTIL WS-VAR > 5
MOVE ‘A’ TO WS-ARRAY(WS-VAR)
END-PERFORM

PERFORM VARYING WS-VAR FROM 1 BY 1 UNTIL WS-VAR > 9
DISPLAY WS-VAR ‘ ‘ WS-ARRAY(WS-VAR)
END-PERFORM

GOBACK.

WILL THE ABOVE SOURCE CODE WORK FINE. PLEASE JUSTITY YOUR ANSWER.
IF YOUR ANSWER IS NO, PLEASE LET US KNOW IF THERE IS A WAY FOR
THE CODE MENTIONED ABOVE TO WORK FINE WITHOUT ANY CHANGES TO
THE SOURCE CODE.

A. PRIMARY REASON FOR THIS QUESTION IS TO LET YOU KNOW ABOUT THE
COMPILER OPTION SSRANGE WHICH HAS TWO OPTIONS.

SSRANGE – CODE IS GENERATED TO PERFORM SUBSCRIPT OR INDEX

CHECKING AT RUN TIME. SO AT RUN TIME, ANY OUT OF RANGE SCENARIO, JOB WOULD ABEND.

NOSSRANGE – NO CODE IS GENERATED TO PERFORM SUBSCRIPT OR INDEX
CHECKING AT RUN TIME. SO AT RUN TIME, ANY OUT OF

RANGE SCENARIO, JOB WILL NOT ABEND.

ANSWER FOR THIS QUESTION IS PROVIDED BELOW.

WS-VAR IS DEFINED AS 9(1) WHICH GETS 0 INSTEAD OF 10 AFTER 9TH OCCURRENCE. DUE TO THIS BELOW WILL HAPPEN FOR DIFFERENT SSRANGE VALUES.

A) SSRANGE – JOB WILL FAIL IN THE SECOND PERFORM FOR OUT OF RANGE ARRAY CHECKING WHEN WS-VAR VALUE

IS 6 AS WS-ARRAY HAS ONLY 5 OCCURRENCES.

A. B) NOSSRANGE – JOB WILL GO INTO INFINITE LOOP IN THE SECOND PERFORM LOOP AS WS-VAR WILL NEVER BE GREATER THAN 9.

2. CONSIDER A COBOL CICS DB2 PROGRAM WHICH IS INVOKED BY A TRAN “TACT”. THIS TRAN IS INVOKED FROM A SCREEN WHENEVER USER UPDATES SOME INFO ON THE SCREEN, WHICH NEEDS TO BE UPDATED INTO A DB2 TABLE. CONSIDER A SCENARIO, WHERE 2 USERS TRIES TO UPDATE THE SAME ROW IN A TABLE AT THE SAME TIME. IN THIS SCENARIO, TO ENSURE BOTH UPDATES ARE DONE CORRECTLY WITHOUT ANY DB2 ISSUES, WHAT PRECAUTION WILL YOU TAKE WHILE CODING THE PROGRAM. PLEASE SELECT THE BEST OPTION IF YOU HAVE MULTIPLE ANSWERS.

A. A ROW WILL BE LOCKED TO THE USER WHEN A USER IS UPDATING THAT ROW EVEN IF ANY OF THE THREE DB2 ISOLATION LEVEL (RR,RS OR CS) IS USED. SO IN THIS CASE THE FIRST USER THAT ACTUALLY GETS HOLD (LOCK) OFF THE ROW, WILL UPDATE THE ROW AND GET AN SQLCODE OF 0. BUT FOR THE SECOND USER, WHO TRIED TO UPDATE THE ROW AT THE SAME TIME AS FIRST USER, HE WILL GET AN UNAVAILABLE RESOURCE (SQL CODE -904) CONDITION. SO THIS SQLCODE CAN BE MADE USE OF, AND WHENEVER -904 OCCURS, THE CICS COMMAND “DELAY” CAN BE MADE USE OF TO DELAY THE PROCESSING OF TASK FOR AN INTERVAL, AND THE UPDATE QUERY CAN BE REEXECUTED POST THE INTERVAL. IN THIS WAY, BOTH THE USERS DATA WOULD BE UPDATED.

NOTE: THIS QUESTION SEEMS TO BE BIT AMBIGUOUS. BUT THIS QUESTION WAS FRAMED BASED ON MY REAL TIME EXPERIENCE.

3. IS THERE A WAY TO COMMUNICATE WITH YOUR PEER WHO IS ALSO LOGGED ON INTO MAINFRAME THROUGH MAINFRAME. IF YES, PLEASE MENTION THE WAY.

A. YES. WE CAN MAKE USE OF TSO SEND COMMAND.

TSO SEND ‘ MSG HERE ‘ USER(USER ID)

Important SQL CODES and ABEND CODES
SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
KNOW YOUR MAINFRAME
REXX – INITIAL SETUP
KNOW YOUR MAINFRAME
KNOW YOUR MAINFRAME – WEEK 1
KNOW YOUR MAINFRAME – WEEK 1 – SOLUTIONS
KNOW YOUR MAINFRAME – WEEK 2
KNOW YOUR MAINFRAME – WEEK 2 – SOLUTIONS
KNOW YOUR MAINFRAME – WEEK 3
KNOW YOUR MAINFRAME – WEEK 3 – SOLUTIONS
KNOW YOUR MAINFRAME – WEEK 4
KNOW YOUR MAINFRAME – WEEK 4 – SOLUTIONS
KNOW YOUR MAINFRAME – WEEK 5
KNOW YOUR MAINFRAME – WEEK 5 – SOLUTIONS
KNOW YOUR MAINFRAME – WEEK 6
KNOW YOUR MAINFRAME – WEEK 6 – SOLUTIONS
Advertisements