Need help on the prompt override program

260 pts.
Tags:
CL Program
PGM
Hello, I have command which when prompted asks for a confirmation and if a 'Y' is given then 2 more parameters appear retrieving data from a data area. I have setup the program override program and the confirm parameter on the command as a 'key parameter', the parms that retrieve data from the data area are non-key parameters. Now my problem is that these non key parms are passed as '' '' (null string to my CL PGM). What am I missing?


Software/Hardware used:
OS/400
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 19  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    Have the variables been defined in the CL, and how are they populated? It's hard to provide help without seeing the code. Post it here and you will get a better response.
    134,495 pointsBadges:
    report
  • yaazhisai
    Todd, here is the code:

    Command Source:
    CMD        PROMPT('DUPTAP')      
                                                            
                                                            
    PARM       KWD(CONFIRM) TYPE(*CHAR) LEN(1) RSTD(*YES) + 
                 VALUES(Y N) MIN(1) KEYPARM(*YES) +         
                 PROMPT('Duplicate Friday tape Y or N?')    
    PARM       KWD(FROMSEQ) TYPE(*CHAR) LEN(6) RSTD(*NO) +  
                 MIN(0) PMTCTL(YES) KEYPARM(*NO) +          
                 PROMPT('From Sequence')                    
    PARM       KWD(TOSEQ) TYPE(*CHAR) LEN(6) RSTD(*NO) +    
                 MIN(0) PMTCTL(YES) KEYPARM(*NO) +          
                 PROMPT('TO SEQUENCE')                      
    YES:        PMTCTL     CTL(CONFIRM) COND((*EQ Y))  


    CPP:

     PGM        PARM(&CONFIRM &FROMSEQ &TOSEQ)                         
                                                                       
                DCL        VAR(&FROMSEQ) TYPE(*CHAR) LEN(6)            
                DCL        VAR(&TOSEQ) TYPE(*CHAR) LEN(6)              
                DCL        VAR(&CONFIRM) TYPE(*CHAR) LEN(1)            
     SNDPGMMSG  MSG('*FROMSEQ = ' *CAT &FROMSEQ)   
     SNDPGMMSG  MSG('*TOSEQ = ' *CAT &TOSEQ)       
     ENDPGM          
    260 pointsBadges:
    report
  • yaazhisai
    When the command is run, the parameters are retrieved on the command, however they are not passed on to the CPP. But if I manually edit the key parameters - just merely type in the same values over what appears, they get passed. This is so weird.
    260 pointsBadges:
    report
  • ToddN2000
    What does the command look like when you do a DSPCMD? What is the program to be called & does it match your CLP? Do the parameter definitions match those from the screen?
    134,495 pointsBadges:
    report
  • yaazhisai
    I do a DSPCMD for my command - TEST/DUPTAP, the CPP is:

    Program to process command . . . . . . :   DUPTAP  
      Library  . . . . . . . . . . . . . . :     TEST

    and yes all these do exist. I also have the PMTOVRPGM to my POP. It exists too. Everything seems to be in place except that those non key parameters that retrieves the values from my data area are not getting passed on to CPP. As I said, when is use my DUPTAP command and do an F4, take otpion 'Y', hit ENTER, it does show the retreived values for my sequence numbers as below:

    Duplicate  Y or N?  . > Y             Y, N                
    From  . . . . . . . .   *FIRST        Character value     
    TO   . . . . . . . . . .   *LAST         Character value    

    But if I HIT ENTER, the CPP does not SNDPGMMSG my sequence numbers. However If I just overwrite those From and To values - just type in the same over it, it gets passed on! 
    260 pointsBadges:
    report
  • ToddN2000
    I do not see the code where it should be retrieving the data from your data area. Can you post that as well?
    134,495 pointsBadges:
    report
  • yaazhisai
    Sorry, here is the prompt override program that retrieves from the data area:

    PGM    PARM(&CMDNAME &KEYPARM &RTNSTR)   
    DCL        VAR(&CMDNAME) TYPE(*CHAR) LEN(20)       
    DCL        VAR(&KEYPARM) TYPE(*CHAR) LEN(1)        
    DCL        VAR(&RTNSTR) TYPE(*CHAR) LEN(5700)      
     DCL        VAR(&STRLEN) TYPE(*DEC) LEN(5 0) VALUE(131)              
     DCL        VAR(&BINLEN) TYPE(*CHAR) LEN(2)                          
     DCL        VAR(&FROMSEQKWD) TYPE(*CHAR) LEN(10) VALUE('?<FROMSEQ(') 
     DCL        VAR(&FSEQ) TYPE(*CHAR) LEN(6)                            
     DCL        VAR(&TOSEQKWD) TYPE(*CHAR) LEN(9) VALUE(' ?<TOSEQ(')     
     DCL        VAR(&TSEQ) TYPE(*CHAR) LEN(6)                            
                                                                         
     DCL        VAR(&CLOSPAREN) TYPE(*CHAR) LEN(1) VALUE(')')            
    RTVDTAARA  DTAARA(QUSRSYS/FRIDAY_DUP (1 6)) RTNVAR(&FSEQ)  
    RTVDTAARA  DTAARA(QUSRSYS/FRIDAY_DUP (7 6)) RTNVAR(&TSEQ)  
                                                               
    CHGVAR VAR(%BIN(&BINLEN)) VALUE(&STRLEN)                   
    CHGVAR     VAR(&RTNSTR) VALUE(&BINLEN)                          
    CHGVAR     VAR(&RTNSTR) VALUE(&RTNSTR *TCAT &FROMSEQKWD)        
    CHGVAR     VAR(&RTNSTR) VALUE(&RTNSTR *TCAT &FSEQ)              
    CHGVAR     VAR(&RTNSTR) VALUE(&RTNSTR *TCAT &CLOSPAREN)         
    CHGVAR     VAR(&RTNSTR) VALUE(&RTNSTR *TCAT &TOSEQKWD)          
    CHGVAR     VAR(&RTNSTR) VALUE(&RTNSTR *TCAT &TSEQ)              
    CHGVAR     VAR(&RTNSTR) VALUE(&RTNSTR *TCAT &CLOSPAREN)         
    ENDPGM       
    260 pointsBadges:
    report
  • ToddN2000
    Forgive me if I still seem confused..What are you actually trying to do? It seems like there would be a much easier way than you are attempting.

    I still have a few questions, 
    What are you building the &RTNSTR for?
    If prompting for &FROMSEQ and &TOSEQ why even use the dataarea values ?
    Is this a new project or are you modifying existing code ?
    I do not see where the parms &CMDNAME &KEYPARM are getting set to ?
    134,495 pointsBadges:
    report
  • yaazhisai
    hey Todd, sorry if I confused you - this is what I am actually trying to do and its a new project, not an existing one:

    Why am I prompting for data area values? 

    Because these data area values are changed by other programs and I want the current values of the data area to be loaded onto my command.

    What am I building the &RTNSTR for?

    The program that builds the RTNSTR is the prompt override program which is set on my command, so when I prompt the command this return string is returned to my command to retrieve the current data area values.
    Also the &CMDNAME and &KEYPARM are just needed to be passed on - I found this info from the IBM CL programming manual for V5R2, page 326. 

    And I really appreciate your help on this!
    260 pointsBadges:
    report
  • ToddN2000
    Have you checked the IBM site for info? LINK

    Been a long time since I had to work with a prompt override program. Have to try and test some thing out when i have access to our AS/400. Why not create a new program instead of a prompt override?
    134,495 pointsBadges:
    report
  • yaazhisai
    Thanks, the link you provided - was what I followed while writing the POP. And I searched the web too for any info that could help me but no. 

    What do you mean by creating a new program? How can I accomplish retrieving data area values during runtime without a POP?
    260 pointsBadges:
    report
  • ToddN2000
    What type of data area are you looking for the values in, one in a library or a users local area (*LDA)?
    134,495 pointsBadges:
    report
  • yaazhisai
    The data area is in a library.
    260 pointsBadges:
    report
  • yaazhisai
    And I want it to be retrieved over a command.
    260 pointsBadges:
    report
  • ToddN2000
    You could try something like this.
    Create a DSPF
    A*%%TS  SD  20150225  141140  TSTTRN      REL-V7R1M0  5770-WDS 
    A*%%EC                                                         
    A                                      DSPSIZ(24 80 *DS3)      
    A                                      MSGLOC(24)              
    A                                      CF03(03 'EXIT')         
    A                                      CF05(05 'RUN')          
    A                                      PRINT                   
    A          R PROMPT                                            
    A*%%TS  SD  20150225  141140  TSTTRN      REL-V7R1M0  5770-WDS 
    A                                  1 30'COMMAND PROMPT'        
    A                                      DSPATR(HI)              
    A                                  1 65DSPATR(HI)              
    A                                      DATE                    
    A                                      EDTCDE(Y)               
    A                                  6 30'PARM 1:'               
    A                                  1  4TIME                    
    A            PARM1          6A  B  6 41CHECK(RZ)               
    A            PARM2          6A  B  9 41CHECK(RZ)               
    A            YESNO          1A  B 12 44VALUES('Y' 'N') 
    A            SUBMSG        30A  O 18 22                    
    A                                 15 29'CMD-5 TO PROCESS'  
    A                                 24  5'CMD-3 EXIT'        
    A                                  9 30'PARM 2:'           
    A                                 12 30'YES/NO'            
    ************* End of data *********************************
    Then create the CLLE 
                 PGM                                        
                                                            
                 DCL        VAR(&VAR1) TYPE(*CHAR) LEN(6)   
                 DCL        VAR(&VAR2) TYPE(*CHAR) LEN(6)   
                 DCL        VAR(&VARYN) TYPE(*CHAR) LEN(1)  
                 DCLF       FILE(MY_DDS)                    
                                                            
    get_data:                                               
                                                            
    /* get values from data area */                         
                 RTVDTAARA  DTAARA(DATA1 *ALL) RTNVAR(&VAR1)
                 RTVDTAARA  DTAARA(DATA2 *ALL) RTNVAR(&VAR2)
                                                            
    /* move values to screen */                             
                 CHGVAR     VAR(&PARM1) VALUE(&VAR1)        
                 CHGVAR     VAR(&PARM2) VALUE(&VAR2)        
                 CHGVAR     VAR(&YESNO) VALUE('Y')          
                                                            
    /* display screen */
                                                                   
                 SNDRCVF    RCDFMT(PROMPT)                         
                                                                   
    /* f3 to exit ? */                                             
                                                                   
                 IF         COND(&IN03) THEN(GOTO CMDLBL(END_JOB)) 
                                                                   
    /* do command here, then loop back to get new values */        
                                                                   
                 GOTO       CMDLBL(GET_DATA)                       
                                                                   
     end_job:    endpgm                                            
    ****************** End of data ********************************
    Then create a command to run your program.
    134,495 pointsBadges:
    report
  • yaazhisai
    Thanks Todd, While I could work on your suggestion, its being a riddle why the prompt override wouldn't work. Its kind of annoying me because I'm sure its just a simple step that I am missing for the lack of practice with POP. Greatly appreciate all your advice on this!!!
    260 pointsBadges:
    report
  • yaazhisai
    Oh I just resolved this!!!! The problem was with the prompt override program command string:

    Because I was using selective prompting, the declaration should be like this:

    DCL        VAR(&FROMSEQKWD) TYPE(*CHAR) LEN(10) VALUE('<?FROMSEQ(') 
    DCL        VAR(&TOSEQKWD) TYPE(*CHAR) LEN(9) VALUE(' <?TOSEQ(')    

    Rather than what I was using like this:

    DCL        VAR(&FROMSEQKWD) TYPE(*CHAR) LEN(10) VALUE('??FROMSEQ(') 
    DCL        VAR(&TOSEQKWD) TYPE(*CHAR) LEN(9) VALUE(' ??TOSEQ(')    


    Notice the value assigned to the variables. I'm so glad this works.


    260 pointsBadges:
    report
  • ToddN2000
    Glad you got it working. I did not notice the < sign myself. I guess we both learned something.
    134,495 pointsBadges:
    report
  • yaazhisai
    I'm sure we did, thanks for all your time Todd!
    260 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: