HP3000-L Archives

July 2000, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Boris Kortiak <[log in to unmask]>
Reply To:
Boris Kortiak <[log in to unmask]>
Date:
Mon, 10 Jul 2000 12:35:04 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (91 lines)
Thanks to everyone's help and suggestions, here is what I came up with (MPE/iX 5.5 pp7):


!# Based on an algorithm suggested by Jeff Woods [log in to unmask] 
!# with a modification suggested by Rollie Amurao [log in to unmask] 
!# for limiting the year portion of the filename
!# and with thanks for the rest of the HP3000 mailing list for their always able assistance
!#
!#
!# Prepare the date information
!#
!# Get the month
!#
!SETVAR FTP_MONTH RHT("0" + "!HPMONTH",2)
!#
!# Get the day of the month
!#
!SETVAR FTP_DAY RHT("0" + "!HPDATE",2)
!#
!# Combine to form a single number
!#
!SETVAR FTP_MMDD "!FTP_MONTH" + "!FTP_DAY"
!#
!# Find the number of years elapsed since 1999
!# Thanks to Rollie, this reduced the number of output digits even more
!#
!CALC !HPYYYY - 1999
!SETVAR FTP_YO !HPRESULT
!#
!# Combine the year offset with the rest of the date information
!# derived before.
!#
!SETVAR FTP_YOMMDD RHT("!FTP_YO",1) + "!FTP_MMDD"
!#
!# Now get the time information
!#
!# Start with the hour
!#
!SETVAR FTP_HOUR RHT("0" + "!HPHOUR",2)
!#
!# Now get the minute
!#
!SETVAR FTP_MINUTE RHT("0" + "!HPMINUTE",2)
!#
!# Combine the time into a single value
!#
!SETVAR FTP_HHMM,"!FTP_HOUR" + "!FTP_MINUTE"
!# 
!# Now put the time and date together into a single data element
!#
!SETVAR FTP_DTS,"!FTP_YOMMDD" + "!FTP_HHMM"
!#
!# Set the starting value for the conversion routine
!#
!SETVAR FTP_WORK,FTP_DTS
!# Initialize the output data element
!#
!SETVAR FTP_OUT ""
!#
!# Initialize the string of values for conversions of values greater than 9
!#
!SETVAR FTP_STRING "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
!#
!# Enter loop to process the conversion
!#
!WHILE !FTP_WORK > 0 DO
!   CALC !FTP_WORK MOD 36
!   SETVAR FTP_INT,!HPRESULT
!   IF !FTP_INT > 9 THEN
!      SETVAR FTP_NDX,!FTP_INT + 1
!      SETVAR FTP_OUT, &
!         STR("!FTP_STRING",!FTP_NDX,1)+"!FTP_OUT"
!   ELSE
!      SETVAR FTP_OUT,"!FTP_INT" + "!FTP_OUT"
!   ENDIF
!   CALC !FTP_WORK / 36
!   SETVAR FTP_WORK,!HPRESULT
!ENDWHILE
!#
!# With the converted data create the file name
!#
!SETVAR FTP_SAVE,"I" + "!FTP_OUT" + ".txt"
!#
!# The next step isn't really needed, but I had it in there while
!# debugging this CI script as a double check.
!#
!SHOWVAR FTP_@


And that's how I did it.  I can already see that there are some improvements possible, but it ain't broke so I'm not going to fix it.  All comments greatly appreciated.

ATOM RSS1 RSS2