HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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.