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: 

SORTing a VMS file as per time stamp

 
SOLVED
Go to solution
Sk Noorul Hassan
Regular Advisor

SORTing a VMS file as per time stamp

Hi all,

Please guide me on how to sort the file as per time stamp in descending order. I am atttaching a sample file for this.
5 REPLIES
labadie_1
Honored Contributor

Re: SORTing a VMS file as per time stamp

if your file is called a.tmp, something like

sort /key=(pos:39,siz=19) a.tmp b.tmp

You have the sorted file in b.tmp

$ Help sort

will give you more information.
Robert Gezelter
Honored Contributor

Re: SORTing a VMS file as per time stamp

Hassan,

After lookiing at your sample file, a straightforward observation: First correct the time/date format to yyyy-mm-dd:hh:mm:ss.

Changing the time information to the above format will allow the time/date information to be sorted as a single key. Then use a SORT command as Gerard stated in his post.

- Bob Gezelter, http://www.rlgsc.com
Jan van den Ende
Honored Contributor

Re: SORTing a VMS file as per time stamp

Slihgt correction on Gerard Labadie's answer.
Sin your date-stamp is NOT Year-month-day, you need to construct a multi-key SORT, for which you have to break-up your date-field.

As Gerard says:
$ HELP SORT
especially the /KEY paragraph is relevant here.

hth

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Hein van den Heuvel
Honored Contributor
Solution

Re: SORTing a VMS file as per time stamp

That dd-mm-yyyy:hh:mm:cc is an easy time stamp!
Too bad it was not yyyy-mm-dd:.... even easier!

Anyway to get several ideas:
google: +openvms +directory +sort "by date"

And of course, check HELP SORT/KEY as suggesed.

A recent entry here with tricky, textual, months:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1095459

Actual solution is probably:

$ sort/key=(pos:46,size:4,des)/key=(pos:43,siz:2,des)/key=(pos:40,siz:2,des)/key=(pos:51,siz:8,des)

hth,
Hein

Sk Noorul Hassan
Regular Advisor

Re: SORTing a VMS file as per time stamp

Thanks for your help.