![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: is it possible to sort the times in this txt file using DCL programming? here is a sample of the output and a sample of the sorted output that it needs to be. thanks in advance. **Before ** @INIT F115 115 T101 113 @START 00:00:00 01-11-13 05:07:00 F115 120 05:11:00 F115 115 05:22:00 F115 120 05:25:00 F115 115 05:11:00 T101 115 05:24:00 T101 117 05:25:00 T101 120 @END 23:59:59 01-11-13 ** After this is what I want it to end up as @INIT F115 115 T101 113 @START 00:00:00 01-11-13 05:07:00 F115 120 05:11:00 T101 115 05:11:00 F115 115 05:22:00 F115 120 05:24:00 T101 117 05:25:00 F115 115 05:25:00 T101 120 @END 23:59:59 01-11-13 The Answer is : $ if p1 .eqs. "" then $ inquire p1 "File to be sorted" $ close /nolog infile $ open infile 'p1' $ close /nolog outfile $ open /write outfile 'p1' $ read infile line $ write outfile line $ read infile line $ write outfile line $ read infile line $ write outfile line $ read infile line $ write outfile line $ close /nolog temp $ open /write temp x.x $ loop1: $ read infile line $ if f$element( 0, " ", line ) .eqs. "@END" then $ goto done1 $ write temp line $ goto loop1 $ done1: $ save = line $ close temp $ close infile $ sort x.x z.z /key = ( position:1, size:8 ) $ delete x.x. $ open temp z.z $ loop2: $ read /end_of_file = done2 temp line $ write outfile line $ goto loop2 $ done2: $ close temp $ delete z.z. $ write outfile save $ close outfile
|