AS400 and CLLE: PGM issue

225 pts.
Tags:
as/400 data
CLLE
PGM
I made a PGM for read as well as write the record in DSPF but my PGM doesn't read that PF it not showing any error .. it shows Blank value in variable.
PGM                                                                             
             DCL        VAR(&WS) TYPE(*CHAR) LEN(10) /* variable */             
             DCL        VAR(&WSPID4) TYPE(*CHAR) LEN(10) /*DSPF field*/         
             DCL        VAR(&PDPID) TYPE(*CHAR) LEN(10)  /*PF FIELD*/           
             DCLF       FILE(KRGUNN/TP001P)  OPNID(OP1)  /*PF*/                 
             DCLF       FILE(KRGUNN/TPW005D) RCDFMT(RECDSP) /*DSPF*/            
             OPNDBF     FILE(KRGUNN/TP001P) OPTION(*INP) OPNID(OP1)             
             POSDBF     OPNID(OP1) POSITION(*START)                             
             RCVF       RCDFMT(RTP001P) OPNID(OP1) /*READ PF*/                  
             CHGVAR     VAR(&WS) VALUE(&PDPID) /*MOVE PF VALUE TO VARIABLE*/    
             CHGVAR     VAR(&WSPID4) VALUE(&WS) /*MOVE VARIABLE TO DSPF FLD*/   
             SNDRCVF    RCDFMT(RECDSP)                                          
             CLOF       OPNID(OP1)                                              
 EXIT:       ENDPGM


Software/Hardware used:
i-series
ASKED: February 14, 2012  7:18 AM
UPDATED: June 19, 2013  6:46 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

hi …. Use following reference..

 PGM
DCL VAR(&WS) TYPE(*CHAR) LEN(10) /* variable */

DCL VAR(&WSPID4) TYPE(*CHAR) LEN(10) /*DSPF field*/

DCLF FILE(KRGUNN/TP001P) OPNID(OP1) /*PF*/

DCLF FILE(KRGUNN/TPW005D) RCDFMT(RECDSP) OPNID(OP2) /*DSPF*/

LOOP: SNDRCVF RCDFMT(RECDSP) OPNID(OP2)

RCVF RCDFMT(RECF OF PF) OPNID(OP1)

MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) /* TO CHECK END OF FILE */

CHGVAR VAR(&WS) VALUE(&OP1_PDPID) /* SYNTAX OF MOVEING FIELD VALUE WITH OPEN ID IDENTIFIER */

CHGVAR VAR(&OP2_WSPID4) VALUE(&WS)

IF COND(&OPB_IN03 = '0') THEN(GOTO CMDLBL(LOOP)) /* F3 INDICATOR IN DSPF */

END: ENDPGM

Discuss This Question: 8  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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Nikrajpapa
    THANKS ITS WORK NOW...
    225 pointsBadges:
    report
  • TomLiotta
    DCL VAR(&WS) TYPE(*CHAR) LEN(10) /* variable */ DCL VAR(&WSPID4) TYPE(*CHAR) LEN(10) /*DSPF field*/ DCL VAR(&PDPID) TYPE(*CHAR) LEN(10) /*PF FIELD*/ Why are those three lines in the program? How does your program ever put a value into &PDID? Where do you move any values into your display fields? None of those variables are part of the physical file nor of the display file. Tom
    125,585 pointsBadges:
    report
  • SMisar
    Hi Tom u r right DCL VAR(&WS) TYPE(*CHAR) LEN(10) /* variable */ DCL VAR(&WSPID4) TYPE(*CHAR) LEN(10) /*DSPF field*/ DCL VAR(&PDPID) TYPE(*CHAR) LEN(10) /*PF FIELD*/ these three lines are not require to add in pgm ... Bcoz we can directly move the pf field value to DSPF no need to declare. But I was just adding for his reference... I dont know why he has taken that line...
    130 pointsBadges:
    report
  • TomLiotta
    I dont know why he has taken that line… I asked so that the OP would have to think about them. By talking about them, we could understand how fields from declared files are automatically made available in a CL program. I believe that discussion is better than only providing code. It allows some learning of principles. Tom
    125,585 pointsBadges:
    report
  • SMisar
    Ya.... But it is not possiblae to explain line by line code here.... Thats better to provide correct solution where required... I agree discusion is better but some times...
    130 pointsBadges:
    report
  • TomLiotta
    I agree discusion is better but some times… The site prohibits providing direct solutions for "homework" questions. The example CL was clearly at a "learning" level. In order to determine the reason behind asking the question, some dialog is required first. Tom
    125,585 pointsBadges:
    report
  • SMisar
    Ok Man cool down thats not any political issue to expnad our discussion... Just leave it and cool down............
    130 pointsBadges:
    report
  • HMSSL2K
    Tom, you are right on it. Basic homework question.
    3,175 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following