Page 1 of 1

unable to select data

PostPosted: Fri Jun 29, 2012 7:23 pm
by surime72
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;                                                   


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;                                               



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

Re: unable to select data

PostPosted: Fri Jun 29, 2012 7:38 pm
by surime72
DCL ERROR_S                CHAR(01) INIT('Y');

Re: unable to select data

PostPosted: Fri Jun 29, 2012 8:12 pm
by Akatsukami
Your code is so bad that I can't find words (printable ones, anyway) to adequately condemn it. Do you really think that we'd believe that that steaming heap of raw garbage even compiled?

Re: unable to select data

PostPosted: Fri Jun 29, 2012 8:38 pm
by NicC
Get your code all nicely aligned and indented on your edit screen, cut and paste it into the reply space (use the PostReply button to get into the reply editor), highlight the code in the reply editor and then click the Code button. Then click the preview button. If it looks as though it has kept its alignment then click the submit button otherwise go into the reply editor and fix things up. Repeat until it is readable.

Re: unable to select data

PostPosted: Mon Jul 02, 2012 3:00 pm
by surime72
hi
IF  SHIPPRDT ¬= ' ' THEN                                     
    CALL P9999_HAZ_PARTDETAILS;                                 
          IF REPEAT > 0 THEN DO;                               
          CALL ISPLINK ('VPUT ', '(PARTNUMB)','PROFILE');       
          EXEC SQL COMMIT;                                     
                                                               
      CALL ISPLINK ('TBTOP', 'PRDTTHAZ');                       
      CALL ISPLINK ('TBDISPL', 'PRDTTHAZ','PRDTPHAZ');         
         REPEAT = 0;                                           
                                                 
        RETURN;                                                 
       END;                                                     
                                                 
                                                               
 IF ERROR_S = NO THEN 
DO;                                           
   

Re: unable to select data

PostPosted: Mon Jul 02, 2012 3:05 pm
by surime72
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;                                         
                                                     
     PARTNUMB = TBVHBOM4.PART_NO;                   
     CURSOR = 'ACTION';                             
      CALL ISPLINK ('TBADD', 'PRDTTHAZ');           
    ERROR_S = YES;                                   
                                                     
         REPEAT = REPEAT + 1;                       
                  IF  (ZTDSELS = 1) THEN             
                        ZTDSELS = 0;                             
                   ELSE                                         
                       DO;                                       
                         EXEC SQL COMMIT;                       
                         CALL ISPLINK('TBDISPL', 'PRDTT345');   
                       END;                                     
                                                                 
       END;                                                     
                                                                 
     WHEN(100)                                                   
     DO;                                                         
   CURSOR = 'ACTION';                                           
   ERROR_S = NO;                                                 
        REPEAT1 = REPEAT1 + 1;                                   
               IF  (ZTDSELS = 1) THEN                           
                        ZTDSELS = 0;                             
                   ELSE                                         
                       DO;                                       
                         EXEC SQL COMMIT;                       
                      CALL ISPLINK('TBDISPL', 'PRDTT345');
                    END;                                 
 END;                                                     
                                                         
   WHEN(-305)                                             
    DO;                                                   
    CURSOR = 'ACTION';                                   
        END;                                                 
                                                   
   WHEN(-904)                                             
    DO;                                                   
    CURSOR = 'ACTION';                                   
                         
    END;
   OTHERWISE                     
    DO;                         
      TABLE_ID = 'P0845-01';     
      CALL SQL_ERROR;           
    END;                         
                                 
END;          /**   SELECT **/   
END;                             
END;                             


hi igot resolved previous problem while iam getting to select multiple parts for when(1oo)
and it selecting only one part

Re: unable to select data

PostPosted: Mon Jul 02, 2012 3:22 pm
by surime72
or while was selectiong both at a time one is present and other is not present there is problem it was displaying both values inpanel