|
Frank,
Did you not see my reply and several others who told you what the
problem is? You CANNOT pass a variable length field to QCMDEXC
using the CALL/PARM opcodes. It can only be a fixed-length field.
Making it variable length in this context is of no value, but if you
really, really want to use a variable length field, then you MUST
create a prototype for the call to QCMDEXC with each parm being a
CONST value. Then you can pass your varying field without a problem.
But it will continue to fail on the CALL/PARM every time as long as
your parameter is VARYING.
-Bob Cozzi
>
>
>
> Help, I'm still getting the Variable length error. It's getting
the
> error
> on the line where the field AS400CMD is being built. Too me it
> looks like
> it should be long enough to hold the data but it still triggers an
> error.
> Any ideas?
>
> TIA,
>
> Frank
>
>
> * FAX log file
> FQAFFTLOG IF E DISK
> *
> D WKLOOP01 S 1A
> *
> D P1DATE S 8A
> D P1FAXNBR S 12A
> D P1USER S 10A
> D P1EMAIL S 40A VARYING
> *
> D DATE S 8A
> D FAXNBR S 12A
> D USER S 10A
> D STATUS S 1A
> *
> D CMDPART1 S 29A
> D CMDPART2 S 8A
> D CMDPART3 S 9A
> D CMDPART4 S 1A
> D EMAILSUBJ S 100A VARYING
> D EMAILBODY S 500A VARYING
> *
> D COUNTER S 4S 0
> *
> D AS400CMD S 1000A
> D CMDLENGTH S 15P 5
> *
> D AS400CMD2 S 10A
> D CMDLENGTH2 S 15P 5
> *
> * ---------------------
> * Start Main Processing
> * ---------------------
> C EXSR MAINPRCS
> *
> * -------------------
> * End Main Processing
> * -------------------
> C EVAL *INLR = *ON
> C RETURN
> *
>
> ******************************************************************
> * Main Processing Subroutine
> *
>
> ******************************************************************
> C MAINPRCS BEGSR
> *
> *
> C EVAL COUNTER = *ZEROS
> C EVAL WKLOOP01 = 'Y'
> C DOU WKLOOP01 = 'N'
> *
> * Only Process a Maximum of 3 times
> C EVAL COUNTER = COUNTER + 1
> C IF COUNTER >= 0
> C EXSR SNDEMAIL
> C LEAVE
> C ENDIF
> *
> * Wait 3 minutes
> C EVAL AS400CMD2 = 'DLYJOB 180'
> C EVAL CMDLENGTH2 = 10
> C CALL 'QCMDEXC' CMDPARMS2
> *
> * Find row from table(QAFFTLOG)
> C/EXEC SQL
> C+ SELECT QFCDAT, QFDEST, QFUSER, QFSU
> C+ INTO :DATE, :FAXNBR, :USER, :STATUS
> C+ FROM QFAX/QAFFTLOG
> C+ WHERE QFCDAT = :P1DATE AND QFDEST = :P1FAXNBR AND
> C+ QFUSER = :P1USER
> C/END-EXEC
> *
> * Did NOT find Row; Process again
> C IF STATUS = *BLANK
> C ITER
> C ENDIF
> *
> * Fax Successful
> C IF STATUS = 'S'
> C LEAVE
> C ENDIF
> *
> * Fax Unsuccessful
> C IF STATUS = 'U'
> C EXSR SNDEMAIL
> C LEAVE
> C ENDIF
> *
> C ENDDO
> *
> C ENDSR
> *
>
> ******************************************************************
> * SNDEMAIL - Sends "Failed Fax" Email to User
>
> ******************************************************************
> C SNDEMAIL BEGSR
> *
> /FREE
>
> CMDPART1 = 'SNDDST TYPE(*LMSG) TOINTNET((';
> CMDPART2 = ')) DSTD(';
> CMDPART3 = ') LONGMSG(';
> CMDPART4 = ')';
>
> EMAILSUBJ = 'Your Fax to' + '(' +
> %SUBST(P1FAXNBR:3:3) + ')' +
> %SUBST(P1FAXNBR:6:3) + '-' +
> %SUBST(P1FAXNBR:9:4) +
> ' Failed';
>
> EMAILBODY = 'Your Fax to' + '(' +
> %SUBST(P1FAXNBR:3:3) + ')' +
> %SUBST(P1FAXNBR:6:3) + '-' +
> %SUBST(P1FAXNBR:9:4) +
> ' Failed. ' +
> 'Call the customer and ask if they
have
> ' +
> 'received the fax you had tried to
> send. If not,'+
> ' make sure the fax number is
correct.
> Then ' +
> 'resubmit the fax through the same
> program that ' +
> 'it was sent or detach the copies that
> were sent '+
> 'to your email address and print them
> out and ' +
> 'fax them manually.';
>
> error here:
> >>>>>>>>>>>AS400CMD = CMDPART1 + P1EMAIL + CMDPART2 +
> EMAILSUBJ + CMDPART3 + EMAILBODY +
> CMDPART4;
>
> CMDLENGTH = %LEN(%TRIM(AS400CMD));
>
>
> /END-FREE
> *
> C CALL 'QCMDEXC' CMDPARMS
> *
> C ENDSR
> *
>
> ******************************************************************
> * *INZSR
>
> ******************************************************************
> C *INZSR BEGSR
> *
> C *ENTRY PLIST
> C PARM P1DATE
> C PARM P1FAXNBR
> C PARM P1USER
> C PARM P1EMAIL
> *
> C CMDPARMS PLIST
> C PARM AS400CMD
> C PARM CMDLENGTH
> *
> C CMDPARMS2 PLIST
> C PARM AS400CMD2
> C PARM CMDLENGTH2
> *
> C ENDSR
> *
>
> ******************************************************************
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
> mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.