1753687 Members
5449 Online
108799 Solutions
New Discussion юеВ

Re: CONVERT Utility

 

CONVERT Utility

Sometimes a need to delete the last two bytes of each record in a (fixed length record) file. I thought the best way was to do a CONVERT /fdl=<> /Truncate.

But it seems like the data I get in is all wrong. Can someone tell me how truncate works in the Convert utility?

Dom
3 REPLIES 3
Veli K├╢rkk├╢
Trusted Contributor

Re: CONVERT Utility

DCL help suggests that this should work.
And I tried it. Created a small datafile with 12 char long records

$ ty aaa.2
123456789012
123456789012
123456789012
123456789012
123456789012
123456789012
123456789012
123456789012

and converted it using

$ convert/fdl=fix aaa.2 aaa.3/stat/trunc

CONVERT Statistics
Number of Files Processed: 1
Total Records Processed: 8 Buffered I/O Count: 14
Total Exception Records: 0 Direct I/O Count: 47
Total Valid Records: 8 Page Faults: 28
Elapsed Time: 0 00:00:01.67 CPU Time: 0 00:00:00.03

where fix.fdl contained

IDENT FDL_VERSION 01 "11-JUL-2005 22:07:02 OpenVMS FDL Editor"

SYSTEM
SOURCE "OpenVMS"

FILE
ALLOCATION 0
BEST_TRY_CONTIGUOUS yes
EXTENSION 0
ORGANIZATION sequential

RECORD
BLOCK_SPAN yes
CARRIAGE_CONTROL carriage_return
FORMAT fixed
SIZE 10

and result is

$ ty aaa.3
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890

this was done on OpenVMS V8.2 (Alphaserver 1000 5/400)

so, what hardware, what operating system version, are patches uptodate, what does "all wrong" actually mean?

_veli

Bojan Nemec
Honored Contributor

Re: CONVERT Utility

Dom,

If you need this, for converting files you mentioned in yours previous thread

http://forums2.itrc.hp.com/service/forums/questionanswer.do?threadId=938757

leave the file as stream and convert it with a fdl which has fixed records:

$ CONVERT/FDL=SYS$INPUT
RECORD
FORMAT FIXED
SIZE 50
^Z

Bojan
Hein van den Heuvel
Honored Contributor

Re: CONVERT Utility

check out my reply to http://forums2.itrc.hp.com/service/forums/questionanswer.do?threadId=938757

That /TRUN is only needed if you alterred the file attributes.

The truncate works by reading the input file with simple sequential $GET calls and only $PUTting the maximum record size number of bytes into the output file. It is only in effect for output files with an MRS attribute (which is implied by RFM=FIX).
For fixed length records it is mostly used in conjuction with /PAD

hth,
Hein.