Previous Topic
Table Of Contents
Parent Topic
Next Topic

High-Level Language SWSEbcdicToAscii (SWCPEB) Function

Related Topics

Web Server API Function Index


May be used in Shadow/REXX
May be used from Other REXX interpreters
HLL entry point name is SWCPEB

SWSEbcdicToAscii is the Web Server API function used to translate an EBCDIC character string to an ASCII character string.

SWCPEB Call Arguments

The SWSEbcdicToAscii (SWCPEB) function arguments are described in the table which follows. Only five of the six parameters are required.

Arg.
No.
HLL Argument Type I/O Description of Argument
C COBOL PL/I
1 LONG PIC
S9(5)
COMP
FIXED
BIN(31)
Input Connection Handle. Currently ignored however, it must contain zeros.
2 LONG PIC
S9(5)
COMP
FIXED
BIN(31)
Input Input string length.
3 CHAR * PIC
X(nnn)
CHAR(nnn) Input EBCDIC character string.
4 LONG PIC
S9(5)
COMP
FIXED
BIN(31)
Input Output string area length.
5 CHAR * PIC
X(nnn)
CHAR(nnn) Output Output string area. The first 2 bytes of this area will contain the binary length of the actual string returned from the character translation.
6 CHAR * PIC
X(4)
CHAR(4) Input Language Code. This optional parameter allows you to select the language code translation table that will be used to convert the input string. If this parameter is not specified, the default language code assigned to the Shadow Server address space will be used.

Top

Return Values

SWSEbcdicToAscii always sets a signed numeric return code value. Possible values are:

SWS_SUCCESS
The operation succeeded. The specified operation was performed.
 
SWS_ERROR
A parameter validation or run-time error was encountered. Error information is available using the SWSERROR function.
SWS_ENVIRONMENT_ERROR
The request can not be processed because of a run-time environmental error. For example, you invoked the API service outside of a Web transaction procedure or from outside the server's address space. Use the server's wrap-around trace to obtain diagnostic information.
 
Any other value
The operation failed. By using the SWSERROR interface, you may obtain the error message pertinent to the error.
 

 

PL/I Example


 
    %INCLUDE SPCPHD
       .
       .
       .
       .
    DCL  CONNHDL         FIXED BIN(31);        /* Connection Handle   */
    DCL  RC              FIXED BIN(31);        /* RETURN CODE         */
    DCL  INLEN           FIXED BIN(31);        /* Input String Length */
    DCL  OUTLEN          FIXED BIN(31);        /* Output String Length*/
    DCL  INDATA          initial('ABCDEFGH')  char(8);
    DCL  OUTDATA         char(10);             /* Output data area    */
    DCL  LANGCODE        initial('ENG ')      char(4);
 
 
    CALL SWSEbcdicToAscii(CONNHDL,             /* Connection Handle   */
                        INLEN,                 /* Input String Length */
                        INDATA,                /* Input String Area   */
                        OUTLEN,                /* Output String Length*/
                        OUTDATA,               /* Output String Area  */
                        LANGCODE);             /* Language Code       */
 
    RC = PLIRETV();                     /* GET RETURN CODE         */
    IF RC ,= SWS_SUCCESS THEN           /* EXIT PROGRAM IF BAD RC  */
       EXIT;
 

Top

C Example


 
    #include "sccphd.h"                 /* Neon headers            */
 
       .
       .
       .
       .
    long RC;                            /* return code             */
    long connHDL;                       /* statement handle        */
    long inlen    = 8;                  /* input buffer length     */
    long outlen   = 10;                 /* output buffer length    */
    char outdata]10(;                   /* input buffer area       */
    char indata]( = 'ABCDEFGH';         /* eight byte filler field */
    char langcode]( = 'ENG ';           /* language code           */
 
    CALL SWSEbcdicToAscii(connHDL,          /* statement handle       */
                        inlen,
                        indata,
                        outlen,
                        outdata,
                        langcode);
 
    if (rc ,= SWS_SUCCESS)
         return rc;
  

Top

COBOL Example


 
    COPY SBCPHD.                        Neon Copybook
        .
        .
        .
        .
    77 CONNECTION-HANDLE       USAGE IS POINTER.
    77 LANGUAGE-CODE           PIC X(4)   VALUE 'ENG '.
    01 INPUT-BUFFER.
      05 INPUT-DATA-LENGTH     PIC S9(5)  COMP  VALUE 8.
      05 INPUT-DATA            PIC X(8)   VALUE 'ABCDEFGH'.
    01 OUTPUT-BUFFER.
      05 OUTPUT-DATA-LENGTH    PIC S9(5)  COMP  VALUE 8.
      05 OUTPUT-DATA-AREA.
         10 OUTPUT-DATA-LEN    PIC S9(3)  COMP.
         10 OUTPUT-DATA        PIC X(8).
        .
        .
        .
        .
 
    CALL 'SDCPEB' USING CONNECTION-HANDLE,
                        INPUT-DATA-LENGTH,
                        INPUT-DATA,
                        OUTPUT-DATA-LENGTH,
                        OUTPUT-DATA-AREA,
                        LANGUAGE-CODE.
 
    MOVE RETURN-CODE TO WS-SWSAPI-RETURN-CODE.
    IF NOT SWS-SUCCESS
        GOBACK.
 

Top