ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Remote Call Program

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

  • Remote Call Program

    Good Afternoon,

    I had tried posting this earlier, received an error. This explanation is a bit lighter then my previous attempt. I have an RPG program that needs to be capable of accepting remote call. It has a file name as a single parameter. I have no RPG experience although I use Power-shell and SQL a ton. Please let me know if anymore info is required. The program is pasted below. My current RPG programmers seem hush hush on whether or not remote call is doable. My attempts produce errors listed below code. Thanks for any additional insight on the subject. My research into remote calls against the I series seems to indicate it as a supported action.

    Code:
     100 /* CHAGE *LDA BY RETRIVING USER ID   */                                                                         10/07/15
        200                                                                                                                 11/09/94
        300 /*-----------------------------------------------------------------*/
        400 /*        Start of Program:                                        */
        500 /*-----------------------------------------------------------------*/
        600              PGM        PARM(&FILE1)                                                                            09/29/15
        700
        800 /*-----------------------------------------------------------------*/
        900 /*        Declare display files and program variables:             */
       1000 /*-----------------------------------------------------------------*/
       1100              DCL        VAR(&WRK001) TYPE(*CHAR)
       1200              DCL        VAR(&WRK002) TYPE(*CHAR)
       1300              DCL        VAR(&WRK003) TYPE(*CHAR)                                                                12/16/91
       1400              DCL        VAR(&WRK004) TYPE(*CHAR)                                                                12/16/91
       1500              DCL        VAR(&WRKUSR) TYPE(*CHAR) LEN(08)                                                        09/29/15
       1600              DCL        VAR(&DTALIB) TYPE(*CHAR) LEN(10)                                                        05/13/03
       1700              DCL        VAR(&FILE1) TYPE(*CHAR) LEN(10)                                                         09/29/15
       1800              DCL        VAR(&UNAME) TYPE(*CHAR) LEN(10)                                                         10/07/15
       1900
       2000 /*-----------------------------------------------------------------*/
       2100 /*        Main program logic:                                      */
       2200 /*-----------------------------------------------------------------*/
       2300 /**  Debtnext Payment Load program                            */                                                08/26/15
       2400 /** (c) 2015 by Quantrax Corporation Inc. */                                                                    02/05/15
       2500 /*-----------------------------------------------------------------*/                                           07/17/96
       2600                                                                                                                 02/07/00
       2700                                                                                                                 05/13/03
       2800              CALL       PGM(GETDTALIB) PARM(&DTALIB)                                                            05/13/03
       2900              CHKOBJ     OBJ(*LIBL/&DTALIB) OBJTYPE(*LIB)                                                        05/13/03
       3000              MONMSG     MSGID(CPF0000) EXEC(DO)                                                                 05/13/03
       3100              SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Invalid +                                          05/13/03
       3200                           Data Library - Check Company Codes') +                                                05/13/03
       3300                           TOPGMQ(*EXT) MSGTYPE(*STATUS)                                                         05/13/03
       3400              DLYJOB     DLY(3)                                                                                  05/13/03
       3500              GOTO       EXIT                                                                                    05/13/03
       3600              ENDDO                                                                                              05/13/03
       3700                                                                                                                 07/22/96
       3800              DLTF       FILE(QTEMP/TAPEIN1)                                                                     12/29/00
       3900              MONMSG     MSGID(CPF2105)                                                                          02/07/00
       4000                                                                                                                 02/07/00
       4100              DLTF       FILE(QTEMP/TEMPCOMA)                                                                    09/21/11
       4200              MONMSG     MSGID(CPF2105)                                                                          09/21/11
       4300                                                                                                                 09/21/11
       4400              CRTPF      FILE(QTEMP/TAPEIN1) RCDLEN(2000) SIZE(*NOMAX)                                           09/24/07
       4500                                                                                                                 02/16/01
       4600              CRTPF      FILE(QTEMP/TEMPCOMA) SRCFILE(QDDSSRCS) +                                                12/27/11
       4700                           SRCMBR(TEMPCOMA) OPTION(*NOSOURCE +                                                   12/27/11
       4800                           *NOLIST) SIZE(*NOMAX) LVLCHK(*NO)                                                     12/27/11
       4900                                                                                                                 02/16/01
       5000              CPYF       FROMFILE(&FILE1) TOFILE(TAPEIN1) +                                                      09/29/15
       5100                           MBROPT(*REPLACE) FMTOPT(*NOCHK)                                                       08/26/15
       5200                                                                                                                 02/07/00
       5300 /* COPY COMMA DELMITED FILES TO A PHYSICAL FILE                    */                                           09/21/11
     5400                                                                                                                 09/21/11
       5500              CPYFRMIMPF FROMFILE(QTEMP/TAPEIN1) +                                                               07/01/14
       5600                           TOFILE(QTEMP/TEMPCOMA) MBROPT(*REPLACE) +                                             07/01/14
       5700                           DTAFMT(*DLM) STRDLM('"') FLDDLM(']') +                                                02/05/15
       5800                           RPLNULLVAL(*FLDDFT)                                                                   07/01/14
       5900              RTVUSRPRF  RTNUSRPRF(&UNAME)                                                                       10/07/15
       6000              CHGDTAARA  DTAARA(*LDA (501 8)) VALUE(&UNAME)                                                      10/07/15
       6100              CHGDTAARA  DTAARA(*LDA (1   8)) VALUE(&UNAME)                                                      10/07/15
       6200              CHGVAR     VAR(&WRK001) VALUE(%SST(*LDA    1    8))                                                01/31/06
       6300              CHGVAR     VAR(&WRK002) VALUE(&WRK001)                                                             01/31/06
       6400              CHKOBJ     OBJ(*LIBL/SCPTRN1) OBJTYPE(*FILE) MBR(&WRK002)                                          09/25/91
       6500              MONMSG     MSGID(CPF9815) EXEC(ADDPFM FILE(SCPTRN1) +                                              09/25/91
       6600                           MBR(&WRK002))                                                                         09/25/91
       6700              CLRPFM     FILE(SCPTRN1) MBR(&WRK002)                                                              12/04/95
       6800 /*                                                      */                                                      09/25/91
       6900              CHGVAR     VAR(&WRK001) VALUE(%SST(*LDA    1    8))                                                01/31/06
       7000              CHGVAR     VAR(&WRK002) VALUE(&WRK001)                                                             01/31/06
       7100              CHGVAR     VAR(&WRK003) VALUE(%SST(*LDA    1    8))                                                01/31/06
       7200              CHGVAR     VAR(&WRK004) VALUE(&WRK003)                                                             01/31/06
       7300              CHKOBJ     OBJ(*LIBL/SCPTRNA) OBJTYPE(*FILE) MBR(&WRK002)                                          12/16/91
       7400              MONMSG     MSGID(CPF9815) EXEC(ADDLFM FILE(SCPTRNA) +                                              05/13/03
       7500                           MBR(&WRK002) DTAMBRS((&DTALIB/SCPTRN1 +                                               05/13/03
       7600                           (&WRK004))))                                                                          05/13/03
       7700                                                                                                                 12/07/95
       7800 /*-----------------------------------------------------------------*/                                           09/16/91
       7900 /*        Override Transactions Files                              */                                           09/16/91
       8000 /*-----------------------------------------------------------------*/                                           09/16/91
       8100              CHGVAR     VAR(&WRK001) VALUE(%SST(*LDA    1    8))                                                01/31/06
       8200              CHGVAR     VAR(&WRK002) VALUE(&WRK001)                                                             01/31/06
       8300              OVRDBF     FILE(SCPTRN1) MBR(&WRK002)                                                              09/25/91
       8400              CHGVAR     VAR(&WRK001) VALUE(%SST(*LDA    1    8))                                                01/31/06
       8500              CHGVAR     VAR(&WRK002) VALUE(&WRK001)                                                             01/31/06
       8600              OVRDBF     FILE(SCPTRNA) MBR(&WRK002)                                                              09/25/91
       8700                                                                                                                 06/30/95
       8800                                                                                                                 01/16/96
       8900              CALL       PGM(PAYDEBN2)                                                                           09/29/15
       9000              CLRPFM     FILE(&FILE1)                                                                            09/29/15
       9100   /*    AUTO EDIT                                                   */                                          09/29/15
       9200              CALL       PGM(PAYEDTCSCL)                                                                         09/29/15
       9300   /*                                                                */                                          05/07/92
       9400 /*-----------------------------------------------------------------*/                                           09/16/91
       9500 /*        REMOVE OVERRIDES                                         */                                           09/16/91
       9600 /*-----------------------------------------------------------------*/                                           09/16/91
       9700  BYPAS1:     DLTOVR     FILE(SCPTRN1)                                                                           09/26/91
       9800              DLTOVR     FILE(SCPTRNA)                                                                           09/25/91
       9900              CHGVAR     VAR(&WRK001) VALUE(%SST(*LDA    1    8))                                                01/31/06
      10000              CHGVAR     VAR(&WRK002) VALUE(&WRK001)                                                             01/31/06
      10100              RMVM       FILE(SCPTRNA) MBR(&WRK002)                                                              12/16/91
      10200              MONMSG     MSGID(CPF7310)                                                                          12/16/91
      10300              CHGVAR     VAR(&WRK001) VALUE(%SST(*LDA    1    8))                                                05/02/92
      10400              RCLRSC                                                                                             04/07/92
      10500   /*    AUTO POST                                                   */                                          09/29/15
      10600              CHGVAR     VAR(&WRKUSR) VALUE(%SST(*LDA  501    8))                                                09/29/15
    
    10700              CHGDTAARA  DTAARA(*LDA (501 8)) VALUE('AUTO')                                                      09/29/15
      10800              CALL       PGM(PAYUPDCUCL)                                                                         09/29/15
      10900              CHGDTAARA  DTAARA(*LDA (501 8)) VALUE(*BLANKS)                                                     09/29/15
      11000              CHGDTAARA  DTAARA(*LDA (501 8)) VALUE(&WRKUSR)                                                     09/29/15
      11100                                                                                                                 26/00/01
      11200 /*-----------------------------------------------------------------*/                                           26/00/01
      11300 /*        Common exit point                                        */                                           26/00/01
      11400 EXIT:                                                                                                           07/18/96
      11500 /*-----------------------------------------------------------------*/
      11600 /*        End of Program:                                          */
      11700 /*-----------------------------------------------------------------*/
      11800              ENDPGM
    -----------------------------------------------------------------------
    Message ID . . . . . . : RPG0907 Severity . . . . . . . : 99
    Message type . . . . . : Inquiry
    Date sent . . . . . . : 10/13/15 Time sent . . . . . . : 14:53:04
    Message . . . . : PRLGCHK 1300 decimal-data error in field (C G S D F).
    Cause . . . . . : The RPG program PRLGCHK in library SCLIB found a
    decimal-data error at statement 1300. One field did not contain valid
    numeric data. The digit and/or sign is not valid.
    Recovery . . . : Enter C to cancel, G to continue processing at *GETIN, S
    to obtain a system dump, or D to obtain an RPG formatted dump.

    --------------------------------------------------------------------------------

    Message ID . . . . . . : CPA0701 Severity . . . . . . . : 99
    Message type . . . . . : Inquiry
    Date sent . . . . . . : 10/13/15 Time sent . . . . . . : 14:54:12
    Message . . . . : RPG9001 received by PROCHGPYCL at 2500. (C D I R)
    Cause . . . . . : Control language (CL) program PROCHGPYCL in library SCLIB
    detected an error at statement number 2500. Message text for RPG9001 is:
    Error RPG0907 caused program PRLGCHK to stop.
    Recovery . . . : This inquiry message can be avoided by changing the
    program. Monitor for the error (MONMSG command) and perform error recovery
    within the program. To continue, choose a reply value.
    ------------------------------------------------------------------------------------------

    Message ID . . . . . . : RNQ0907 Severity . . . . . . . : 99
    Message type . . . . . : Inquiry
    Date sent . . . . . . : 10/13/15 Time sent . . . . . . : 14:54:38
    Message . . . . : Decimal-data error occurred (C G D F).
    Cause . . . . . : RPG procedure PAYEDT in program SCLIB/PAYEDT found a
    decimal-data error at statement 2042. A packed or zoned value does not
    contain valid numeric data. A digit and/or sign is not valid.
    Recovery . . . : Contact the person responsible for program maintenance to
    determine the cause of the problem. A response of 'D' will cause an RPG
    formatted dump which may be useful in determining which field has the
    decimal-data error. However, it may be an intermediate value that has the
    error, if the error occurred in an expression.
    -------------------------------------------------------------------------------------
    Message ID . . . . . . : CPA0701 Severity . . . . . . . : 99
    Message type . . . . . : Inquiry
    Date sent . . . . . . : 10/13/15 Time sent . . . . . . : 14:55:03
    Message . . . . : CEE9901 received by PAYEDTCSCL at 12000. (C D I R)
    Cause . . . . . : Control language (CL) program PAYEDTCSCL in library SCMOD
    detected an error at statement number 12000. Message text for CEE9901 is:
    Application error. MCH1202 unmonitored by PAYEDT at statement 0000002042,
    instruction X'0000'.
    Recovery . . . : This inquiry message can be avoided by changing the
    program. Monitor for the error (MONMSG command) and perform error recovery
    ----------------------------------------------------------------------------------------------

    Message ID . . . . . . : CPA0701 Severity . . . . . . . : 99
    Message type . . . . . : Inquiry
    Date sent . . . . . . : 10/13/15 Time sent . . . . . . : 14:55:22
    Message . . . . : CPF9999 received by PAYDEBNCL2 at 9200. (C D I R)
    Cause . . . . . : Control language (CL) program PAYDEBNCL2 in library SCMOD
    detected an error at statement number 9200. Message text for CPF9999 is:
    Function check. CEE9901 unmonitored by PAYEDTCSCL at statement 12000,
    instruction X'00F7'.
    Recovery . . . : This inquiry message can be avoided by changing the
    program. Monitor for the error (MONMSG command) and perform error recovery
    within the program. To continue, choose a reply value.

  • #2
    Re: Remote Call Program

    I think you pasted the wrong program. That's a CL program, not an RPG program. It looks like you have two RPG programs getting an error: PRLGCHK and PAYEDT.

    Comment


    • #3
      Re: Remote Call Program

      Code:
         4400              CRTPF      FILE(QTEMP/TAPEIN1) RCDLEN(2000) SIZE(*NOMAX)                                           09/24/07
         4500                                                                                                                 02/16/01
         4600              CRTPF      FILE(QTEMP/TEMPCOMA) SRCFILE(QDDSSRCS) +                                                12/27/11
         4700                           SRCMBR(TEMPCOMA) OPTION(*NOSOURCE +                                                   12/27/11
         4800                           *NOLIST) SIZE(*NOMAX) LVLCHK(*NO)                                                     12/27/11
         4900                                                                                                                 02/16/01
         5000              CPYF       FROMFILE(&FILE1) TOFILE(TAPEIN1) +                                                      09/29/15
         5100                           MBROPT(*REPLACE) FMTOPT(*NOCHK)                                                       08/26/15
         5200                                                                                                                 02/07/00
         5300 /* COPY COMMA DELMITED FILES TO A PHYSICAL FILE                    */                                           09/21/11
       5400                                                                                                                 09/21/11
         5500              CPYFRMIMPF FROMFILE(QTEMP/TAPEIN1) +                                                               07/01/14
         5600                           TOFILE(QTEMP/TEMPCOMA) MBROPT(*REPLACE) +                                             07/01/14
         5700                           DTAFMT(*DLM) STRDLM('"') FLDDLM(']') +                                                02/05/15
         5800                           RPLNULLVAL(*FLDDFT)                                                                   07/01/14
      This code makes no sense to me. Why are you copying &File1 into TAPEIN1 and then trying to copy it to TEMPCOMA?
      Your comments indicate that TAPEIN1 will be a comma delimited file. Why do you think that? Have the quotes/delimiters magically appeared or are they in the original &File1? Without some clue as to how the data is formatted in the files, this is a guessing game.

      It's also completely unknown what files the RPG programs are looking at as no mention is made of these apart from calls in the code. However, given the decimal data error, one could guess that these copies haven't worked as you've intended them to resulting in some character data being placed into a numeric field (you are using *NOCHK after all).

      Comment


      • #4
        Re: Remote Call Program

        John, it looks like TAPEIN1 is a flat file that will contiain the data in CSV format. TEMPCOMA is an externally defined file with the appropriate fields in it, and CPYFRMIMPF is used to convert from the comma delimited file in TAPEIN1 to the fields in TEMPCOMA.

        What part of that makes no sense to you? It seems simple enough to me.

        The only weird thing is that he's using ] as a delimiter instead of a comma, but maybe that's how the fields are formatted?

        Comment


        • #5
          Re: Remote Call Program

          Originally posted by Scott Klement View Post
          John, it looks like TAPEIN1 is a flat file that will contiain the data in CSV format. TEMPCOMA is an externally defined file with the appropriate fields in it, and CPYFRMIMPF is used to convert from the comma delimited file in TAPEIN1 to the fields in TEMPCOMA.
          It may make sense if the original file is a tape file rather than a PF. And I guess going by the file name (TAPEIN1) then this may be the case. The help text on CPYFRMIMPF suggests it supports tape files so it seems to be additional unnecessary processing.
          But as I said, without some details on the files, this is all guess work.

          Comment


          • #6
            Re: Remote Call Program

            Originally posted by john.sev99 View Post
            It may make sense if the original file is a tape file rather than a PF. And I guess going by the file name (TAPEIN1) then this may be the case.
            No.. it can't be a tape file, it's created in the code provided using the CRTPF command. But, for example, someone could use FTP in ASCII mode to copy a stream file (either from the IFS or from another computer) into FILE1, which is used to populate TAPEIN1. FTP is just an example, it could be several other different file transfer approaches... At any rate, once you have data in the file in CSV format or another appropriate, delimited, format, CPYFRMIMPF makes sense to convert it to an externally defined PF.

            I certainly agree with you that this is guess work. This is the sort of thing that someone on site really needs to troubleshoot. The idea would be to look at the programs where the error is occuring, and see what it's doing at that point. This should tell you which field it's using. Then, look at the record it's processing, and see what's in that field value. something is wrong with it (it's not a valid number, for example.. the error message tells you that part) so check out the file... find the problem and fix it.

            This isn't really something we can do for you over the forums -- you need to learn how the programs are supposed to work, discover what is wrong, and fix them.

            Comment


            • #7
              Re: Remote Call Program

              Originally posted by Scott Klement View Post
              No.. it can't be a tape file, it's created in the code provided using the CRTPF command.
              When I referred to a tape file, I was referring to the original copy of &FILE1 into QTEMP. I was thinking &FILE1 could be a tape file.
              Originally posted by Scott Klement View Post
              But, for example, someone could use FTP in ASCII mode to copy a stream file (either from the IFS or from another computer) into FILE1, which is used to populate TAPEIN1. FTP is just an example, it could be several other different file transfer approaches... At any rate, once you have data in the file in CSV format or another appropriate, delimited, format, CPYFRMIMPF makes sense to convert it to an externally defined PF.
              That's my point. Why copy it to QTEMP/TAPEIN1 if it's already a CSV formatted STMF? The original copy of &FILE1 to &TAPEIN1 doesn't convert it to a CSV format so I guess the original &FILE1 must be that why. Why not use the CPYTOIMPF to copy the file direct and bypass the intermediary copy to TAPEIN1? I don't really get these additional copies.

              Comment

              Working...
              X