Skip navigation
2399 Views 7 Replies Latest reply: Apr 16, 2012 5:14 PM by rpusr RSS
rpusr New Enzee 13 posts since
Jan 25, 2012
Currently Being Moderated

Feb 14, 2012 12:26 PM

Delimiter for space and fixed width in nzload?

Can anyone tell me what is the delimiter for space and fixed width files in nzload?

For tab delimiter it is \t, but can't seem to figure out for space and fixed width files.

 

Thanks

  • Shawn Fox Enzee Exraordinaire 1,482 posts since
    Aug 15, 2006
    Currently Being Moderated
    1. Feb 14, 2012 12:45 PM (in response to rpusr)
    Re: Delimiter for space and fixed width in nzload?

    A fixed width file doesn't have delimiters, that is the entire point of fixed width.  I'm not sure what you mean when you say space, do you mean the standard space character?  That would be -delim 32 (you can use the ascii character code with the -delim parameter)

  • ganesh.soundar New Enzee 5 posts since
    Nov 16, 2011
    Currently Being Moderated
    2. Feb 14, 2012 12:55 PM (in response to rpusr)
    Re: Delimiter for space and fixed width in nzload?

    What do you mean by delimiter for space and fixed width files? There is no column delimiter for fixed width files. You should create a control file which defines the record layout.

  • ganesh.soundar New Enzee 5 posts since
    Nov 16, 2011
    Currently Being Moderated
    4. Mar 5, 2012 1:31 PM (in response to rpusr)
    Re: Delimiter for space and fixed width in nzload?

    Here you go

    nzload -u ${NZ_USER} -pw ${NZ_PWD} -host ${NZ_HOST} -db ${NZ_DB -t ${TGT_TABLE} -cf ${CTL_FILE_NM} -lf ${LOGFILE} -bf ${BADFILE} 2> ${LOAD_TBL_ERR}

     

    Control file

     

    DATAFILE /development/df2/us7/data/us7_004_s00020_01333
    {
    format fixed
    maxerrors 0
    layout (
    PUT_TRANSACTION_TYPE char(1) bytes 1,
    PUT_SUPPLIER_ID char(5) bytes 5,
    PUT_BATCH_NUMBER char(5) bytes 5,
    PUT_PATIENT_NBR char(11) bytes 11,
    PUT_PATIENT_TRACKER_NUMBER varchar(30) bytes 30,
    PUT_PATIENT_DOB varchar(6) bytes 6,
    FILLER_8 varchar(2) bytes 2,
    PUT_PATIENT_GENDER varchar(1) bytes 1,
    PUT_CMF_OUTLET varchar(8) bytes 8,
    PUT_START_DATE varchar(8) bytes 8,
    PUT_END_DATE varchar(8) bytes 8,
    PUT_PATIENT_BRIDGE_KEY_RULE varchar(1) bytes 1,
    OLD_PATIENT_BRIDGE_KEY varchar(40) bytes 40
           )
    }

    DATAFILE <Specfiy the file name>

    {

    format fixed

    maxerrors 0

    layout (

    COLUMN1 char(1) bytes 1,

    COLUMN2 char(5) bytes 5,

    COLUMN3 char(5) bytes 5,

    COLUMN4 char(11) bytes 11,

    COLUMN5 varchar(30) bytes 30,

    COLUMN6 varchar(6) bytes 6,

    COLUMN7 varchar(2) bytes 2,

    COLUMN8 varchar(1) bytes 1,

    COLUMN9 varchar(8) bytes 8,

    COLUMN10 varchar(8) bytes 8,

    COLUMN11 varchar(8) bytes 8,

    COLUMN12 varchar(1) bytes 1,

    COLUMN13 varchar(40) bytes 40

           )

    }

  • nickg Active Enzee 248 posts since
    Mar 16, 2011
    Currently Being Moderated
    6. Apr 4, 2012 5:36 PM (in response to rpusr)
    Re: Delimiter for space and fixed width in nzload?

    NZLoad is a very simple tool with very few features.  It expects the file content to match the definition, so you cannot selectively exclude columns.

    There are two different approaches you can take to perform transformation on the source:

    1. Use NZLoad to get the data in as-is from the source, then use SQL to move what you want, where you want.

    2. Define the source as an external table (which is what NZLoad does anyway) and use SQL to read the source and place the data where you want it.

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points