ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

rpg returns null

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • rpg returns null

    Hi


    Problem is that I have created one that is below in this paragraph. I am unable to get values on Java code. I got only null from there. please help me to get values from there.

    PHP Code:
    *****************************RPG PROGRAM*************************************
     
    dstdid s 10i 0
    dStdid1 S 10a
    dstdname s 10a
    daddress1 s 10a
    dcity1 s 10a
    dErrorid s 1a
    doption s 1a
     
    *entry plist
    c parm STDID1
    c parm STDNAME
    C parm address1
    c parm city1
    c parm errorid
    c parm option
     
    eval stdid=%int(stdid1)
     
    c/Exec sql Include SQLCA
    c
    /End-exec
     
    C SELECT
     
    C when option
    ='I'
    c exsr insert1
     
    C WHEN option
    ='S'
    c exsr select1
     
    C WHEN option
    ='D'
    c exsr delete1
     
    c endsl
     
    Return
     
    *--------------------------------------------------------------
    insert or update subroutine
    *--------------------------------------------------------------
     
    c INSERT1 BEGSR
     
    c
    /Exec sql Include SQLCA
    c
    /End-exec
     
    c
    /Exec sql insert into student1/smaster1 (sid,name,address,city)
    cVALUES( :stdid, :stdname, :address1, :city1)
    c/end-exec
     
    If Sqlcode = -803
     
    Eval Errorid 'D'
     
    c/Exec sql
    c
    Update student1/smaster1 set name= :stdnamecity = :city1,
    caddress= :address1
    c
    where (sid = :stdid)
    c/end-exec
     
    *
     
    Else
     
    Eval Errorid 'Y'
     
    Endif
     
    *
     
    c commit
     
    c Errorid Dsply
     
    c endsr
     
    *---------------------------------------------------------------
    SELECT subroutine
    *---------------------------------------------------------------
     
    c select1 begsr
     
    c
    /exec sql
    c
    + declare A cursor for
    cselect nameaddresscity from student1/smaster1 where sid=:stdid
    c
    +
    c/end-exec
     
    c
    /exec sql
    c
    open A
    C
    /end-exec
     
    c
    /exec sql
    c
    fetch A into :stdname, :address1,:city1
    c
    /end-exec
     
    c
    /exec sql
    c
    close A
    C
    /end-exec
     
    c endsr
     
    *-------------------------------------------------------------
    DELETE subroutine
    *-------------------------------------------------------------
     
    c delete1 begsr
     
    c
    /Exec sql
    C
    DELETE FROM STUDENT1/SMASTER1 WHERE sid= :stdid
    c
    /end-exec
     
    IF sqlcode=100
     
    eval errorid='N'
     
    c errorid dsply
     
    endif
     
    c endsr
     
    **************************************JAVA CODE*********************************
    if (
    pgm.run())
    {
     
    // parmList = pgm.getParameterList();
     
    String sts = ((String) (new AS400Text(10).toObject(parmList[3].getInputData(), 0)));
     
    Object asRC null
    // pgm.getParameterList().length,
     
    sts parmList[0].getOutputData().toString(); //OUTPUT NULL
    sts parmList[1].getOutputData().toString();//OUTPUT NULL
    sts parmList[2].getOutputData().toString();//OUTPUT NULL
    sts parmList[3].getOutputData().toString();//OUTPUT NULL
    sts parmList[4].getOutputData().toString();//OUTPUT NULL
    sts parmList[5].getOutputData().toString();//OUTPUT NULL
     
    }
    else
    {
    AS400Message[] messageList pgm.getMessageList();
    for (
    int msg 0msg messageList.lengthmsg++) {
     
    }

    Last edited by gcraill; June 21, 2008, 04:39 AM. Reason: Readability
Working...
X