P9999_HAZ_PARTDETAILS: PROC TBMHAZ = 'PARTNUMB';
CALL ISPLINK
('TBCREATE', 'PRDTTHAZ',' ', TBMHAZ, 'NOWRITE', 'REPLACE');
DO WHILE (ZTDSELS > 0);
IF SHIPPRDT ¬= ' ' THEN DO;
EXEC SQL SELECT PART_ITEM_NO INTO :HOLD_HAZ
FROM SHIP.TBSHPITM
WHERE
PART_ITEM_NO = :TBVHBOM4.PART_NO FETCH FIRST ROW ONLY;
SELECT (SQLCODE);
WHEN(0)
DO;
/*ERROR_S = Y; */
PARTNUMB = TBVHBOM4.PART_NO;
CURSOR = 'ACTION';
CALL ISPLINK ('TBADD', 'PRDTTHAZ');
ERROR_S = Y;
REPEAT = REPEAT + 1; IF (ZTDSELS = 1) THEN
ZTDSELS = 0;
ELSE
DO;
EXEC SQL COMMIT;
CALL ISPLINK('TBDISPL', 'PRDTT345');
END;
* IF ERROR_SW
THEN RETURN; */
END;
WHEN(100)
DO;
CURSOR = 'ACTION';
ERROR_S = N;
IF (ZTDSELS = 1) THEN
ZTDSELS = 0; ELSE
DO;
EXEC SQL COMMIT;
CALL ISPLINK('TBDISPL', 'PRDTT345');
END;
END;
WHEN(-305)
DO;
CURSOR = 'PARTQ';
CALL ISPLINK ('SETMSG','SHIPJ107');
ERROR_SW = YES;
RETURN;
END;
WHEN(-904)
DO;
CURSOR = 'PARTQ';
CALL ISPLINK ('SETMSG','SHIPK101'); ERROR_SW = YES;
RETURN;
END;
OTHERWISE
DO;
TABLE_ID = 'P0845-01';
CALL SQL_ERROR;
END;
END; /** SELECT **/
END;
END;
IF REPEAT > 0 THEN DO;
CALL ISPLINK ('VPUT ', '(PARTNUMB)','PROFILE');
EXEC SQL COMMIT;
CALL ISPLINK ('TBTOP', 'PRDTTHAZ'); CALL ISPLINK ('TBDISPL', 'PRDTTHAZ','PRDTPHAZ');
REPEAT = 0;
END;
END;
CALL ISPLINK
('TBCREATE', 'PRDTTHAZ',' ', TBMHAZ, 'NOWRITE', 'REPLACE');
DO WHILE (ZTDSELS > 0);
IF SHIPPRDT ¬= ' ' THEN DO;
EXEC SQL SELECT PART_ITEM_NO INTO :HOLD_HAZ
FROM SHIP.TBSHPITM
WHERE
PART_ITEM_NO = :TBVHBOM4.PART_NO FETCH FIRST ROW ONLY;
SELECT (SQLCODE);
WHEN(0)
DO;
/*ERROR_S = Y; */
PARTNUMB = TBVHBOM4.PART_NO;
CURSOR = 'ACTION';
CALL ISPLINK ('TBADD', 'PRDTTHAZ');
ERROR_S = Y;
REPEAT = REPEAT + 1; IF (ZTDSELS = 1) THEN
ZTDSELS = 0;
ELSE
DO;
EXEC SQL COMMIT;
CALL ISPLINK('TBDISPL', 'PRDTT345');
END;
* IF ERROR_SW
THEN RETURN; */
END;
WHEN(100)
DO;
CURSOR = 'ACTION';
ERROR_S = N;
IF (ZTDSELS = 1) THEN
ZTDSELS = 0; ELSE
DO;
EXEC SQL COMMIT;
CALL ISPLINK('TBDISPL', 'PRDTT345');
END;
END;
WHEN(-305)
DO;
CURSOR = 'PARTQ';
CALL ISPLINK ('SETMSG','SHIPJ107');
ERROR_SW = YES;
RETURN;
END;
WHEN(-904)
DO;
CURSOR = 'PARTQ';
CALL ISPLINK ('SETMSG','SHIPK101'); ERROR_SW = YES;
RETURN;
END;
OTHERWISE
DO;
TABLE_ID = 'P0845-01';
CALL SQL_ERROR;
END;
END; /** SELECT **/
END;
END;
IF REPEAT > 0 THEN DO;
CALL ISPLINK ('VPUT ', '(PARTNUMB)','PROFILE');
EXEC SQL COMMIT;
CALL ISPLINK ('TBTOP', 'PRDTTHAZ'); CALL ISPLINK ('TBDISPL', 'PRDTTHAZ','PRDTPHAZ');
REPEAT = 0;
END;
END;
here
CALL P9999_HAZ_PARTDETAILS;
IF ERROR_S = Y THEN DO;
CALL ISPLINK ('SETMSG','SHIPK101');
RETURN;
END;
/*IF ERROR_SW
THEN RETURN;
ELSE
CALL ISPLINK ('SETMSG','SHIPK101'); */
IF ERROR_S = N THEN
DO;
IF ERROR_S = Y THEN DO;
CALL ISPLINK ('SETMSG','SHIPK101');
RETURN;
END;
/*IF ERROR_SW
THEN RETURN;
ELSE
CALL ISPLINK ('SETMSG','SHIPK101'); */
IF ERROR_S = N THEN
DO;
here when it sql code =o it will need to display panel
when sqlcode= 100 need to continue previously
here iam getting problem is IF ERROR_S = y then it will diplay panel and message here is no problem while selecting IF ERROR_S = N then the loop is also going to same i,e it is not giong to IF ERROR_S = N condition .
when we give both IF ERROR_S = y and IF ERROR_S = N it was taking only one i.e which we given first in the loop i.e IF ERROR_S = y