Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note
Note: This Built-In Function is designed to work only with text data files.

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

L

Req

Name of the primary working list that is to receive the transformed file data.





2

A

Req

Name of file containing input data.

1

256



3

A

Opt

Input File Format.

A = Normal Delimited File.

B = DBF File. (Not available on IBM i.)

C = Column File (with signs)

D = Column File (without signs)

O = Comma Delimited File.

T = Horizontal Tab Delimited File.

The default value is 'A'.

The following special testing options are also available. These options are for testing and debugging only and must not be used in production software.

CL = Expected Column File (with signs) layout.

DL = Expected Column File  (without signs) layout.

Input File Formats A, C, D, O, T, CL and DL support UTF-8 format. This is indicated by placing a 'U' in the second column of this argument (i.e. Format). For example, UTF-8 input for format A would have an Input File Format of 'AU'. Format CL would have an Input File Format of 'CUL'.

1

3



4

A

Opt

Method of handling invalid characters encountered within alphanumeric fields.

B = Replace by blank character.

I = Ignore. Include character.

R = Remove from input.

The default value is B.

1

1



5

A

Opt

Expect Carriage Returns.

N = Do not expect carriage return.

T = Process a truncated line as if it was padded with blanks.

Y = Expect carriage return.

The default is 'Y'.

1

1



6

A

Opt

Decimal Point to be expected. The allowable values are:

R = Decimal points do not exist and should be implied from the definition of the field being loaded. Only valid with file formats C and D.

other - The value to be expected as a decimal point character.

The default is the currently defined system decimal point ( ie: '.' or ',' ).

Note: The use of European style ',' decimal points may create problems in files formats that also use commas to delimit fields.

1

1



7

A

Opt

Close input file option.

Y = Close the file at  completion.

N = Do not close the file at  completion unless the  end of the file is encountered.

The default is Y.

1

1



8

A

Opt

Record Selection Option.

N = No comparison required.

EQ = Equal

GT = Greater Than

GE = Greater Than or Equal To

LT = Less Than

LE = Less Than or Equal To

NE = Not Equal

The default is N.

This option is not available when input file type is B.

1

20



9

N

Opt

Record Selection Position.
The position in the input record that is to be compared with the compare value. The first byte in the record has the position 1.

The default is 1.

This argument is ignored if argument number 8 is specified as N.

1

Unlimited

0

0

10

u

Opt

Record Selection Compare Value. When a record is read from the input buffer it is compared with this value (at the position specified). The number of bytes to be compared is the length of the field which holds the value.

If the comparison is true the record is processed.  If it is false the record is  skipped. The comparison is done with the current value of this field for its full length in its current case. This argument is ignored if argument number 8 is specified as N.

There is no default. If *DEFAULT is specified, no comparison will happen.

1

256



11 - 20

L

Opt

Allows up to 10 "appendage" working lists to be specified. Refer to the following notes for more details.

Valid only if the primary working list is an RDML list.





Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Return Code.

OK - File data transformed
EF - File transformed into list(s). End of input file was encountered before the list overflowed.
OV - File transformed into list(s). End of input file not encountered before list was full (ie: overflow).
FE - Format Error. For example, input file format is specified as UTF-8 but file is in UTF-16 format.
ER - Error when opening file..

2

2



Technical Notes - TRANSFORM_FILE

...

     def_list #list fields(....) listcount (#count)
         type (*working) entrys (100)
dowhile (#retcode *ne EF)
     use TRANSFORM_FILE into #list (with "do
                             not close" option)
     execute processlist
endwhile
execute processlist

...

The following table indicates the types of errors that you can trap at the RDML level with an "ER" return code (User Trap) and those that will cause a complete failure of your application (System Error). System errors invoke Visual LANSA full error handling and cause the entire X_RUN "session" to end. They cannot normally be trapped at the RDML level.

Type Of Error

Resulting Action

Attempt to open too many input files

System Error

Input file option is not A, T, C, D, B or O

System Error

Invalid character option is not I, B or R

System Error

Carriage control option is not Y, N or T

System Error

Close file option is not Y or N

System Error

Appendage list has wrong maximum entries value

System Error

Error when attempting to open input file

User Trap

Error while reading from input file

System Error

Bad or unexpected data in input file

System Error

Error Handling Note

It is very strongly recommended that you avoid building complex error handling schemes into your applications. Use a very simple trap like this at all levels of your application.

...