HP3000-L Archives

July 2000, Week 1

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:
Russ Smith <[log in to unmask]>
Reply To:
Russ Smith <[log in to unmask]>
Date:
Wed, 5 Jul 2000 21:06:01 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (86 lines)
Okay Boris,

    You made me think on this one.  Alright, CCYYMMDDhhmm is actually six
pairs of numbers.  CC is going to be 20 for the next 99 years, MM will never
exceed 12, DD will never exceed 31, and hh will never exceed 23.  YY and mm
are the only points of concern.  YY is not likely to exceed 36 during the
period of time you will need this script, so let's concentrate on the mm.
'mm' is the minute and can range from 00 to 59.  Any value greater than 36
would fall outside the base value and would require repeating, thus negating
a unique filename theorem.  There are only six pairs, however, and with the
need for only the first position character, you have seven characters to
work with so, the minute value can be split into two values showing the
number of minutes having passed in each of the two half hours of the hour in
question.  So, how about this.....

# begin script
# initialize the 36 character array
setvar XSTRING "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
# initialize the date and time string
setvar pre_DSTRING "!HPDATETIME"
# expand the minute variable to take up positions 6 and 7.
setvar mmSTRING STR("!pre_DSTRING",11,2)
if !mmSTRING < 30
  setvar format_minute "00" + "!mmSTRING"
else
  setvar mmSTRING2 !mmSTRING - 30
  setvar format_minute "30" + "!mmSTRING2"
endif
setvar DSTRING STR("!pre_DSTRING",1,10) + "!format_minute"
# initialize filename variable to begin with character "X"
setvar FILENAME "X"
# loop through the date time variable and add characters to the filename
setvar ICTR 1
while ICTR < 8 do
  setvar START ICTR*2
  setvar START !START - 1
  setvar POS STR("!DSTRING",!START,2)
  setvar POS !POS + 1
  setvar NEXTCHAR STR("!XSTRING",!POS,1)
  setvar FILENAME "!FILENAME" + "!NEXTCHAR"
  setvar ICTR !ICTR + 1
endwhile
# echo the filename to the stdlist
echo FILENAME is !FILENAME
# end if script

All the files will begin with "X" and this script will work until January of
2036.  It's not very pretty, but it works.  Also, note that HPDATETIME is
not available until 6.0 PP1.  If you are still on 5.5, you will need to play
around with HPYYYY, HPMONTH, HPDAY, HPHOUR and HPMINUTE.  You will need to
zero fill where appropriate and piece together the CCYYMMDDhhmm variable.
Once set, however, the remainder of this script will work perfectly.

When I ran this on my system at 5:43pm on 7/5, the value 200007051743 was
converted to XUAHFR5N.  If you reverse the XSTRING to have the numbers
first, the same value produces a file named XK075HUD.

Good luck and HTH,
Rs~
Russ Smith, Systems Consultant
Problem Solved, Vacaville, CA
r s m i t h @ c u - h e l p . c o m
h p 3 k - l @ e - 3 0 0 0 . n e t

----- Original Message -----
From: "Boris Kortiak" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Thursday, June 29, 2000 1:15 PM
Subject: [HP3000-L] JCL to covert 12 digit dec to 8 digit base 36


I'm trying to create unique file names for files being FTP'd from out HP
e3000 to a workstation which doesn't support long file names.

I figured the best thing to use would be a date time stamp. So using a JCL I
can create a file name that looks like "200006281604", but this is too long
for use on the target machine.  If I convert this to a base 36 number
([0-9,A-Z]) it will always fit into 8 digits for all the date ranges I can
foresee (Y28k or thereabouts).

Anyway, my question is: has anyone written a routine in JCL to convert
numbers between various bases?  Does anyone have any suggestions on how to
go about this?

Any and all suggestions gratefully appreciated.

ATOM RSS1 RSS2