Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Vi editor/How to view txt file in Hex format

Status
Not open for further replies.

SiouxCityElvis

Programmer
Jun 6, 2003
228
US
I've been trying to get a File to UNSTRING when the line sequential file is TAB delimited. The boss wants these files to be queued to me in TAB delimited, so I've got to conquer this challenge.

My problem happens EXACTLY the same way thread209-686046 had the problem. Unfortunately, I still am getting the and want to verify my raw data is indeed TAB delimited. I think the best way to verify this would be if my Vi editor would somehow let me "view" it in hex format.

Please let me know if anyone knows how to view in hex format with Vi editor.

In addition the following is my code...

SELECT ACH-INPUT ASSIGN TO
"/fp/data/import/achqueue/ACHTest.txt"
ORGANIZATION IS LINE SEQUENTIAL
ACCESS IS SEQUENTIAL.

....

WORKING-STORAGE SECTION.
....
01 WS-TAB PIC X(01) VALUE X'09'.
.....

PROCEDURE DIVISION.
...

new UNSTRING-RAW-ACH-DATA.
MOVE SPACES TO WS-DETAIL-RECORD.
MOVE SPACES TO DETAIL-RECORD.
debug DISPLAY ACH-INPUT-RECORD LINE 1 POSITION 1
ERASE EOS.
debug ACCEPT MENU-PROMPT LINE 2 POSITION 1.
UNSTRING ACH-INPUT-RECORD DELIMITED BY WS-TAB
INTO
WS-FP-ACT-NBR
WS-PAYOR-NAME
WS-ABA
WS-ACCOUNT
WS-PAYEE-NAME
WS-ESCROW-ABA
WS-ESCROW-ACCT
WS-FINAL-ABA
WS-FINAL-ACCT
WS-ORIG-CHECK-NBR
WS-CHECK-AMOUNT
WS-TRANS-TYPE
WS-TRAN-DATE
WS-STATEMENT-DESCR
END-UNSTRING.
debug ** DISPLAY WS-TABBED-DATA LINE 1 POSITION 1 ERASE EOS.
DISPLAY WS-FP-ACT-NBR LINE 1 POSITION 1 ERASE EOS.
DISPLAY WS-PAYOR-NAME LINE 2 POSITION 1.
DISPLAY WS-ABA LINE 3 POSITION 1.
DISPLAY WS-ACCOUNT LINE 4 POSITION 1.
DISPLAY WS-PAYEE-NAME LINE 5 POSITION 1.
DISPLAY WS-ESCROW-ABA LINE 6 POSITION 1.
DISPLAY WS-ESCROW-ACCT LINE 7 POSITION 1.
DISPLAY WS-FINAL-ABA LINE 8 POSITION 1.
DISPLAY WS-FINAL-ACCT LINE 9 POSITION 1.
DISPLAY WS-ORIG-CHECK-NBR LINE 10 POSITION 1.
DISPLAY WS-CHECK-AMOUNT LINE 11 POSITION 1.
DISPLAY WS-TRANS-TYPE LINE 12 POSITION 1.
DISPLAY WS-TRAN-DATE LINE 13 POSITION 1.
DISPLAY WS-STATEMENT-DESCR LINE 14 POSITION 1.
ACCEPT MENU-PROMPT LINE 17 POSITION 1.

I've tried using WS-TAB defined as X'05' and X'09'. Nothing seems to work.
So, I'm concluding that something is wrong with the way the raw data is being brought in and the TABS are missing, or something else.

Thanks.
-David
 
One quick test would be to use the INSPECT TALLYING statement to see if any tabs exist in your input record.

Syntax would be something like:

inspect input-record talling tab-counter for all WS-TAB.

Wouldn't be a bad idea as a simple edit to help check record validity as well.
 
Awesome. It showed me for sure that there are no tabs being found. My tab-ctr variable is staying at a value of 0.

So, as Tom mentioned in another thread, something's up with the way it's being stored at the 01 level in file storage.
 
David,

You could use the od command to dump the file.

od -x (or -c) <file> | more

I think your problem is that the file is LINE SEQUENTIAL. TAB characters are not going to be read in. They will be changed to one or more spaces.

Another thing you can do is compile the program with Y option, run the program in debug and display the record in hex.

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top