Page 1 of 1

Help with EBCDIC to ASCII format PL/1

Posted: Tue Sep 17, 2013 7:43 am
by lsnovick
Is possible to process an EBCDIC file that has multiple and variable length record types

I am trying to bring in a EBCDIC file (PL/1) with multiple variable lengths and I can only get the first row to read. The layout looks like the following:

Code: Select all

0 DCL   IMAGE_RECORD         CHAR(480) VAR INIT('');
  DCL 1 IMAGE_LAYOUT         BASED(ADDR(IMAGE_RECORD)),
        2 IMAGE_CNTL_STRLEN    FIXED BIN(15),
        2 IMAGE_CNTL_DATA,
          3 IMAGE_SEG_CODE     BIT(8),
          3 IMAGE_SEG_LVL      BIT(8),
          3 IMAGE_SEG_NAME     CHAR(8),
          3 IMAGE_SEG_LENGTH   FIXED BIN(15),
          3 IMAGE_SEG_KEYOFFS  FIXED BIN(15),
          3 IMAGE_SEG_KEY_LEN  FIXED BIN(15),
          3 IMAGE_SEG_KFB_LEN  FIXED BIN(15),
        2 IMAGE_SEGMENT        CHAR(460);

  DCL 1 IMAGE_TBK001  UNALIGNED  BASED(ADDR(IMAGE_SEGMENT)),
        2 MST_TB_ACCT          CHAR(08),             /* 001-008 KEY*/
        2 MST_TB_ACCT_FILLER   CHAR(04),                /* 009-012 */
        2 MST_LAST_NAME        CHAR(30),                /* 013-042 */

Posted: Tue Sep 17, 2013 8:05 am
by chulett
Are you using the Complex Flat File stage?

Posted: Tue Sep 17, 2013 8:09 am
by lsnovick
Yes.

Posted: Tue Sep 17, 2013 8:35 am
by arunkumarmm
I dont think it is possible to read VB file using CFF in server job but you can do it in a parallel job.

You have marked your job as a server job but posted it in parallel forum.

Posted: Tue Sep 17, 2013 8:44 am
by ArndW
Basically you have a fixed-length 480 byte file with one record layout, according the PL1 description you posted. Not variable length, and it looks like the payload is binary, which is neither ASCII nor EBCDIC.

What columns are you interested in and what data type do you expect them to be in?

Posted: Tue Sep 17, 2013 9:41 am
by lsnovick
After the first row, the data is not readable. It is not coming in correctly. I must have to define it differently. The 480 is not all the redefines. Sometimes it is less than that.

Posted: Tue Sep 17, 2013 10:40 am
by ArndW
I looked at your dclgen again and saw the "VAR" part in the 0 header, I missed that before.

The PL1 data type char var consists of a fixed bin(15) length prefix and then then the character data, so in your case with the redefinition your "IMAGE_CNTL_STRLEN" will contain the record length in bytes. (plus 2 bytes for field itself).

hmmm... that's not quite right, since the DCL1 "IMAGE_SEGMENT" is fixed 460 and the other 20 bytes are in the previous fields to make up 480 bytes exactly.

Does the data contain character or binary information? If you say that some records are not 480 bytes, can you compare that number of bytes with the first 2 bytes of the record to see if that does indeed contain the record length?