| Code: 
							
								
								
								| 
    package paetec.com.www.wbs0004;
 import paetec.com.www.wbs0004.BillingSystemException_t;
import iseries.programcall.base.AbstractProgramCallBean;
import com.ibm.as400.access.AS400Message;
import com.ibm.as400.access.AS400;
import com.ibm.as400.access.ServiceProgramCall;
import com.ibm.as400.access.ProgramParameter;
import com.ibm.as400.access.Trace;
import iseries.programcall.base.RuntimeContext;
import iseries.programcall.base.Constants;
import iseries.programcall.base.Messages;
import com.ibm.as400.access.AS400Text;
import java.util.Hashtable;
 /*
 * <!-- begin-system-doc -->
 * plugin: com.ibm.etools.iseries.javatools
 * version: 7.5.3
 * timestamp: 03:19:35 PM 2009/09/21
 * pcml: paetec.com.www.wbs0004.wbs0004.pcml
 * <!-- end-system-doc -->
 * 
 * Program call bean for invoking program /QSYS.LIB/%LIBL%.LIB/wbs0004.SRVPGM
 */
public class IsInBilling extends AbstractProgramCallBean
{
    private static final long serialVersionUID = 2960724315884918988L;
     // Program parameter: accountId.
    private String accountId = "";
     // Program parameter: billing.
    private String billing = "";
     // Program parameter: error.
    private BillingSystemException_t error =  new BillingSystemException_t();
     // The runtime context
    private static RuntimeContext rtContext = null;
    static {
        rtContext = RuntimeContext.getContext("/invoicePreviewPCW.config");
    }
     public IsInBilling()
    {
        super(rtContext);
        programPath = "/QSYS.LIB/%LIBL%.LIB/wbs0004.SRVPGM";
    }
     /*
     * Set the value of the program parameter: accountId.
     * 
     * @value The value of the parameter.
     */
    public void setAccountId(String value)
    {
        accountId = value;
    }
     /*
     * Get the value of the program parameter: accountId.
     * 
     * @return The value of the parameter.
     */
    public String getAccountId()
    {
        return accountId;
    }
     /*
     * Set the value of the program parameter: billing.
     * 
     * @value The value of the parameter.
     */
    public void setBilling(String value)
    {
        billing = value;
    }
     /*
     * Get the value of the program parameter: billing.
     * 
     * @return The value of the parameter.
     */
    public String getBilling()
    {
        return billing;
    }
     /*
     * Set the value of the program parameter: error.
     * 
     * @value The value of the parameter.
     */
    public void setError(BillingSystemException_t value)
    {
        error = value;
    }
     /*
     * Get the value of the program parameter: error.
     * 
     * @return The value of the parameter.
     */
    public BillingSystemException_t getError()
    {
        return error;
    }
     /*
     * Invoke the program and return the status parameter. 
     * If the invoke fails, you can use the retrieveProgramCallException() 
     * method to determine why the invoke failed.
     * 
     * @return  The value of the status parameter (if specified) is returned if the
     * invoke was successful. Constants.FAILURE otherwise.
     */
    public String invokeReturnStatus()
    {
        if (!invoke()) {
            return Constants.FAILURE;
        }
        return Constants.SUCCESS;
    }
     /*
     * Invoke the program. If the invoke fails, you can use the retrieveProgramCallException()
     *  method to determine why the invoke failed. If the invoke is successful, the
     * output paramters will be updated.
     * 
     * @return True if the program is invoked successfully. False otherwise.
     */
    public boolean invoke()
    {
        AS400 as400 = null;
        try {
            if (connection == null) {
                throw new Exception(Messages.getMsgText("NoConnection"));
            }
             connection.setThreadSafe(false);
            as400 = connection.getAS400();
            ServiceProgramCall thePgm = new ServiceProgramCall(as400);
            ProgramParameter[] parmList = new ProgramParameter[3];
             // Declare converters
            AS400Text as400text1 = new AS400Text(16, as400);
            AS400Text as400text3 = new AS400Text(512, as400);
            AS400Text as400text2 = new AS400Text(1, as400);
             // Process input parameter accountId
            parmList[0] =  new ProgramParameter();
            parmList[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE);
            int accountIdOutputsize = 16;
            int accountIdSize = 16;
            byte [] accountIdInputBuf = new byte[accountIdSize];
            int accountIdInputBufOffset = 0;
            as400text1.toBytes(trimRight(getAccountId()), accountIdInputBuf, accountIdInputBufOffset);
            accountIdInputBufOffset += 16;
            parmList[0].setInputData(accountIdInputBuf);
             // Process input parameter billing
            parmList[1] =  new ProgramParameter();
            parmList[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE);
            int billingOutputsize = 1;
            parmList[1].setOutputDataLength(billingOutputsize);
             // Process input parameter error
            parmList[2] =  new ProgramParameter();
            parmList[2].setParameterType(ProgramParameter.PASS_BY_REFERENCE);
            int errorOutputsize = 512 + 512;
            parmList[2].setOutputDataLength(errorOutputsize);
             // Invoke the program.
            programException = null;
            AS400Message[] myProgramMessages = null;
            thePgm.setProgram(programPath, parmList);
            thePgm.setThreadSafe(false);
            thePgm.setProcedureName("ISINBILLING");
            thePgm.setReturnValueFormat(ServiceProgramCall.NO_RETURN_VALUE);
            if (!thePgm.run()) {
                myProgramMessages = thePgm.getMessageList();
                connection.releaseAS400();
                StringBuffer pgmMsgs = new StringBuffer();
                String NEW_LINE = System.getProperty("line.separator");
                pgmMsgs.append(Messages.getMsgText("InvocationFail") + NEW_LINE);
                for (int msg = 0; myProgramMessages != null && msg < myProgramMessages.length; msg++) {
                    pgmMsgs.append(myProgramMessages[msg].toString() + NEW_LINE);
                }
                throw new java.lang.RuntimeException(pgmMsgs.toString());
            }
             Hashtable offsetStack = new Hashtable();
            int skipBytes = 0;
            int offset = 0;
            // Process output parameter billing
            byte [] billingOutputBuf = parmList[1].getOutputData();
            int billingOutputBufOffset = 0;
            offset = 0;
            skipBytes = 0;
            offset = offset + skipBytes;
            billingOutputBufOffset= offset;
            if(offset + 1 > billingOutputBuf.length) {
                throw new java.lang.RuntimeException(Messages.getMsgText("InsufficientInputData"));
            }
            setBilling(trimRight((String)as400text2.toObject(billingOutputBuf,billingOutputBufOffset)));
            billingOutputBufOffset += 1;
            offset = billingOutputBufOffset;
             // Process output parameter error
            byte [] errorOutputBuf = parmList[2].getOutputData();
            int errorOutputBufOffset = 0;
            offset = 0;
            skipBytes = 0;
            offsetStack.put("billingSystemException_t", new Integer(offset + skipBytes));
            offset = offset + skipBytes;
            setError( new BillingSystemException_t());
            skipBytes = 0;
            offset = offset + skipBytes;
            errorOutputBufOffset= offset;
            if(offset + 512 > errorOutputBuf.length) {
                throw new java.lang.RuntimeException(Messages.getMsgText("InsufficientInputData"));
            }
            getError().setERRORMESSAGE(trimRight((String)as400text3.toObject(errorOutputBuf,errorOutputBufOffset)));
            errorOutputBufOffset += 512;
            offset = errorOutputBufOffset;
            skipBytes = 0;
            offset = offset + skipBytes;
            errorOutputBufOffset= offset;
            if(offset + 512 > errorOutputBuf.length) {
                throw new java.lang.RuntimeException(Messages.getMsgText("InsufficientInputData"));
            }
            getError().setSTACKTRACE(trimRight((String)as400text3.toObject(errorOutputBuf,errorOutputBufOffset)));
            errorOutputBufOffset += 512;
            offset = errorOutputBufOffset;
             return true;
         } catch (Exception e) {
            programException = e;
            Trace.log(Trace.ERROR, e);
            if (rtContext != null && rtContext.throwExceptionOnError()) {
                throw new java.lang.RuntimeException(e);
            }
        }
        finally {
            if (connection != null) {
                try { connection.releaseAS400(); } catch (Exception e) { Trace.log(Trace.ERROR, e); }
            }
        }
        return false;
    }
     /*
     * Get the RuntimeContext for this program call bean.
     * 
     * @return The runtime context.
     */
    public static RuntimeContext getRuntimeContext()
    {
        return rtContext;
    }
 }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 package paetec.com.www.wbs0004;
  /*
 * <!-- begin-system-doc -->
 * plugin: com.ibm.etools.iseries.javatools
 * version: 7.5.3
 * timestamp: 03:19:35 PM 2009/09/21
 * pcml: paetec.com.www.wbs0004.wbs0004.pcml
 * <!-- end-system-doc -->
 * 
 * Class for structure: billingSystemException_t
 */
public class BillingSystemException_t
{
    private static final long serialVersionUID = -3317366758747415735L;
     // Program parameter: ERRORMESSAGE.
    private String ERRORMESSAGE = "";
     // Program parameter: STACKTRACE.
    private String STACKTRACE = "";
     public BillingSystemException_t()
    {
        super();
    }
     /*
     * Set the value of the program parameter: ERRORMESSAGE.
     * 
     * @value The value of the parameter.
     */
    public void setERRORMESSAGE(String value)
    {
        ERRORMESSAGE = value;
    }
     /*
     * Get the value of the program parameter: ERRORMESSAGE.
     * 
     * @return The value of the parameter.
     */
    public String getERRORMESSAGE()
    {
        return ERRORMESSAGE;
    }
     /*
     * Set the value of the program parameter: STACKTRACE.
     * 
     * @value The value of the parameter.
     */
    public void setSTACKTRACE(String value)
    {
        STACKTRACE = value;
    }
     /*
     * Get the value of the program parameter: STACKTRACE.
     * 
     * @return The value of the parameter.
     */
    public String getSTACKTRACE()
    {
        return STACKTRACE;
    }
 }
  |  |