Absent Member.
Absent Member.
2476 views

Level 78 Hex Value Usage

Jump to solution

The following code generated the CRLF and FFLF correctly as 2 bytes. However the TAB also generated 2 bytes  with the first byte being set to <null>... Question is how do I generate a single byte using the technique below or is there another way ?

78 CRLF              value x"0D0A".
78 FFLF               value x"0C0A".
78 TAB                  value x"09".
Thanks
Allen
 
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

It is the file handler during the write that is inserting the null character before each tab and this is default behavior for line sequential files. In fact it will insert a null character before any non-printable character that is written to the file. This is because line sequential files should only contain printable ASCII characters. non-printable characters can cause problems when reading the file. They can cause premature end of record, conditions etc.

The null character is a way of masking the non-printable character within the file so that the file handler can safely read these characters in a record in which case the null will be removed.

If these files are only to be used as text files and you do not need to read them in again then you can turn off this null insertion by setting INSERTNULL=OFF in an extfh.cfg file or by setting the -N run-time switch as greiner posted above.

You can turn on the run-time switch by starting your application with (-N) on the command line or by setting COBSW=-N prior to starting your application.

example:

progname (-N)

or

set COBSW=-N

progname

View solution in original post

0 Likes
8 Replies
Micro Focus Expert
Micro Focus Expert

When I try this here the TAB is generated as one byte and if I move it to a PIC X field it will move the single tab character.

Can you give me an example where this is being treated as 2 bytes?

0 Likes
Absent Member.
Absent Member.

Chris, Please see below:

SELECT MPS-QBEXPORT ASSIGN TO DISK, "C:/MPSDATA/MPS-QB-EXPORT.TXT"

      ORGANIZATION IS LINE SEQUENTIAL

      FILE STATUS IS FSTAT.

.

.

.

FD  MPS-QBEXPORT

LABEL RECORDS ARE STANDARD.

01  QBEXPORT-REC          pic X(1024).

.

.

.

78 TAB               value x"09".

.

.

.

move spaces to QBEXPORT-REC.

string "NAME" delimited by size

      TAB delimited by size

      "DOCNUM" delimited by SIZE

      TAB delimited by size

       "SHIPDATE" delimited by size

      TAB delimited by size

       "SADDR1" delimited by size

      TAB delimited by size

       "INVITEM" delimited by size

      TAB delimited by size

      "PRICE" delimited by size

      TAB delimited by size

      "QNTY" delimited by size

      TAB delimited by size

      "TAXABLE" delimited by size

      TAB delimited by size

      "PRINT" delimited by size

      TAB delimited by size

      into QBEXPORT-REC.

write QBEXPORT-REC.

Results:

4E 41 4D 45 00 09 44 4F 43 4E 55 4D 00 09 53 48 49 50 44 41 54 45 00 09 53 41 44 44 52 31 00 09 49 4E 56 49 54 45 4D 00 09 50 52 49 43 45 00 09 51 4E 54 59 00 09 54 41 58 41 42 4C 45 00 09 50 52 49 4E 54 00 09 0D 0A

Chris... Note the nulls – hope this helps

Allen

0 Likes
Admiral
Admiral

in Cobol workbench 3.x and netexpress 4.x or 5.x this has been solved with Switches as:

set cobsw=-F-N (i mean that -N solve  it), please test it and give a small response

0 Likes
Admiral
Admiral

List of General Run-time Switches

The following general run-time switches are available:

0, 1, 2, ... 8 Programmable switches

A1 Display trailing spaces

B, B1 Skip locked record

C4 Sets screen into 43-line mode

C5 Sets screen into 50-line mode

D Invoke the ANSI COBOL Debug module

E Execute code containing S-level errors

F Validate numeric data in intermediate code

I2 Run-time system error redirection

L1 Disable exception pop-up

L2 Determine record terminator for line sequential files

N Enables null insertion for all line sequential files in your program              !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

S5 Use redirectable console I/O

T Insert tabs in line sequential files

You enter the switches either on the command line or in the environment variable COBSW before you run your program. Switch settings on the command line take precedence over those in COBSW.

0 Likes
Absent Member.
Absent Member.

I don't mean to sound old but I guess I really am... Could you please tell me how to set the environment variable in VS when the executable is built. The days of executing line item arguments are long gone in this new environment. My applications are up and running with this one glitch.... I thank you very much for your prompt response. I do have one more question... The 78 level clearly calls for a one byte move... Why would MF Cobol insert a null in front of each move of the tab character in the string command... Does MF Cobol not follow ANSI standards ?.... Thanks Again !

0 Likes
Micro Focus Expert
Micro Focus Expert

It is the file handler during the write that is inserting the null character before each tab and this is default behavior for line sequential files. In fact it will insert a null character before any non-printable character that is written to the file. This is because line sequential files should only contain printable ASCII characters. non-printable characters can cause problems when reading the file. They can cause premature end of record, conditions etc.

The null character is a way of masking the non-printable character within the file so that the file handler can safely read these characters in a record in which case the null will be removed.

If these files are only to be used as text files and you do not need to read them in again then you can turn off this null insertion by setting INSERTNULL=OFF in an extfh.cfg file or by setting the -N run-time switch as greiner posted above.

You can turn on the run-time switch by starting your application with (-N) on the command line or by setting COBSW=-N prior to starting your application.

example:

progname (-N)

or

set COBSW=-N

progname

View solution in original post

0 Likes
Absent Member.
Absent Member.

Chris... I am not versed in what you are indicating... I did add (-N) to the command line under properties of the actual .exe  meaning myprog.exe (-N) ... At least now understand....

Not to beat a dead horse... I went back into my old RM development environment where I had written many line sequential files for various interfaces and verified that RM's file handlers did not include the <null>... Times have changed and I need to stay more up to date... I thank you for keeping me straight including Mr. Greiner....

Again... My apologies

Thanks for your help...

Allen

0 Likes
Admiral
Admiral

where is the Problem Setting one time a command in the Environment:

set cobsw=-N

and then your application works.

Do you want to load your sequential files to Excel? why do you not use ole and passed this data directly in Excel? Need you help?

I also have work with rmcobol-compiler and was enjoy to pass to MF Workbench 3.x, then Netexpress 2.x,3.x,4.x,5.x and now visual Cobol.With the last, i am learning and have any Problems, here MF must help his customer with webinars and more example for the new graphical Interface (DOTNET)

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.