Help with EBCDIC to ASCII format PL/1

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
lsnovick
Participant
Posts: 80
Joined: Fri May 25, 2007 7:24 am
Location: Troy

Help with EBCDIC to ASCII format PL/1

Post 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 */
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Are you using the Complex Flat File stage?
-craig

"You can never have too many knives" -- Logan Nine Fingers
lsnovick
Participant
Posts: 80
Joined: Fri May 25, 2007 7:24 am
Location: Troy

Post by lsnovick »

Yes.
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post 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.
Arun
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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?
lsnovick
Participant
Posts: 80
Joined: Fri May 25, 2007 7:24 am
Location: Troy

Post 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.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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?
Post Reply