HP 3000 Manuals

BCDICIN/BCDICOUT [ FCOPY Reference Manual ] MPE/iX 5.0 Documentation


FCOPY Reference Manual

BCDICIN/BCDICOUT 

BCDICIN translates code from BCDIC to ASCII. BCDICOUT translates code
from ASCII to BCDIC.

Syntax 

;{BCDICIN } [={field                 } [,EXCLUDE]]
 {BCDICOUT} [ {(field[;field[;...]] )}           ]
Where:

field                 Is a single unsigned integer or a pair of unsigned
                      integers, representing column numbers within the
                      records in the form a; a, b; or a:b.  (The first
                      column of a record is column #1.)

                      In the form a 
                             a is the starting column
                             the last column in the record is the ending
                             column

                      In the form a,b 
                             a is the starting column
                             b is the number of columns to be converted

                      In the form a:b 
                             a is the starting column
                             b is the ending column

EXCLUDE               Specifies that the identified fields are not to be
                      translated.  All other fields are translated.

Operation 

In the following example you have a tape file of employee information.
The name and address occupy the first 75 character positions and are in
BCDIC. The social security number takes up the next five character
positions as a packed decimal.  You can convert the BCDIC fields to
ASCII, and retain the packed decimal file unchanged, by using this
command:

     FCOPY FROM=*TAPEFILE;TO=*EMPDAT;NEW;BCDICIN=1,75 

The field and EXCLUDE parameters let you translate specific data in the
file.  If you do not specify fields or EXCLUDE, the system converts all
data in each record in the file to ASCII. If you specify fields without
specifying EXCLUDE, the system converts only the data within those
fields.  If you specify fields and EXCLUDE, the system converts all data
in each record except for data in the specified fields.

Restrictions 

You cannot use BCDICOUT with CHAR, CLEAR, KANA, OCTAL, HEXO, or HEX.

Notes 

When you use BCDICIN or BCDICOUT with the SUBSET function, the system
makes conversions first.

Five BCDIC character codes can be converted to ASCII in either of two
ways.  FCOPY translates them as shown in table 5-1: 

          Table 5-1.  BCDIC to ASCII Conversion 

---------------------------------------------------------------------------------------------
|                                             |                                             |
|                    BCDIC                    |                    ASCII                    |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
|                   & and +                   |                      +                      |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
|                   % and (                   |                      (                      |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
|                   # and =                   |                      =                      |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
|                   @ and '                   |                      '                      |
|                                             |                                             |
---------------------------------------------------------------------------------------------

Refer to appendix C for a complete list of conversion codes.

The maximum number of fields you can specify is 255.

The translation function does not apply to user labels.  If a file
contains user labels, FCOPY does not translate them. 

Examples 

The example below copies FILE1 to FILE2, converting all characters from
BCDIC to ASCII, except for those in columns 1 through 5 and 10 through
30:

     >FROM=FILE1;TO=FILE2;BCDICIN=(1,5;10:30),EXCLUDE 

The example below copies FILE1 to FILE2, converting only characters in
columns 1 through 5 and 10 through 30 from ASCII to BCDIC:

     >FROM=FILE1;TO=FILE2; BCDICOUT=(1,5;10:30) 



MPE/iX 5.0 Documentation