Re: [U2] Left Outer Join Question

2014-03-05 Thread Keith Johnson [DATACOM]
I wrote a paragraph called ML to use MERGE.LIST on saved lists - much easier 
than assembling the lists manually.


PA
* ML type list1 list2 list3
* I2,TYPE
IF TYPE = U THEN GO THERE
IF TYPE = D THEN GO THERE
IF TYPE = I THEN GO THERE
DISPLAY
DISPLAY Command Format is
DISPLAY ML type list1 list2 list3
DISPLAY
DISPLAY Where type is 'U'nion or 'D'ifference or 'I'ntersection
DISPLAY
DISPLAY and where list1 and list2 exist on SAVEDLISTS.
DISPLAY The result will be stored as list3.
DISPLAY
GO FINISH
*
THERE:
IF I3,LIST1 = '' THEN GO FINISH
IF I4,LIST2 = '' THEN GO FINISH
IF I5,LIST3 = '' THEN GO FINISH
GET.LIST LIST1 TO 1
GET.LIST LIST2 TO 2
*
IF TYPE = U THEN GO UNION
IF TYPE = D THEN GO DIFFERENCE
IF TYPE = I THEN GO INTERSECTION
*
UNION:
MERGE.LIST 1 UNION 2 TO 3
SAVE.LIST LIST3 FROM 3
DISPLAY UNION
GO FINISH
*
DIFFERENCE:
MERGE.LIST 1 DIFFERENCE 2 TO 3
SAVE.LIST LIST3 FROM 3
DISPLAY DIFFERENCE
GO FINISH
*
INTERSECTION:
MERGE.LIST 1 INTERSECTION 2 TO 3
SAVE.LIST LIST3 FROM 3
DISPLAY INTERSECTION
GO FINISH
*
FINISH:
CLEARPROMPTS

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] [UV] Programmatic Verification of Globally Cataloged Subroutine

2014-01-28 Thread Keith Johnson [DATACOM]
Hi,

LeRoy Dreyfuss said that you would have to change 52 to 12 for EXIST to work.

The globally cataloged programs have an extra 40 characters put on the front, 
so that would cause a problem.

@RECORD[1,4] is a count of the number of times the program has been used.

@RECORD[5,8] is who cataloged it

@RECORD[13,4] are the date and time (I think)


Regards, Keith



___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] What is true

2013-07-31 Thread Keith Johnson [DATACOM]
Hi Wil,

That indeed was my code - ten years old now!

I think I read the same article as Kevin. I don't use it in my day to day 
programming (which is in Universe and QM, thus using @TRUE and @FALSE) but I 
think I still would use it for Pickwiki. Just a style thing - de gustibus non 
disputandum est, after all.

Hi Tony,

'Twas a teensy bug under an unusual circumstance... Hey, wait a minute, you're 
the one who complained that no-one updated other people's code! You wouldn't be 
trying to yank Will's chain, would you?


Regards, Keith


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] 'DBTA 100: The Companies That Matter Most in Data'

2013-06-05 Thread Keith Johnson [DATACOM]
DBTA has always been sympathetic to the MV market.

I note not only Rocket but also Entrinsik, Kore, Mpower1, Pickcloud, Revelation 
in the list

Regards, Keith

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Dumping data to file from TCL

2013-02-24 Thread Keith Johnson [DATACOM]
Hi Phil,

If it's just a matter of turning a two-step process into one step, would a 
Paragraph be reasonable? Just thinking of something along the lines of...


PA
IF I2,File = '' THEN GO ENDIT
IF I3,IType = '' THEN GO ENDIT
IF I4,ExportDirectory = '' THEN GO ENDIT
IF I5,Datadump.dat = '' THEN GO ENDIT
SELECT I2,File SAVING I3,IType
LIST I2,File TO I4,ExportDirectory I5,Datadump.dat REQUIRE.SELECT
ENDIT:


Regards, Keith

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] CSV to Array

2012-08-20 Thread Keith Johnson [DATACOM]
No-one seems to have done it, but here's my version of the code.

It's strange, I don't have a problem with CONTINUE and I don't even mind
IF SOMETHING ELSE THIS = THAT
which a lot of people really hate, but I just HAD to reverse the IF/CASE 
statement order.

SUBROUTINE REXY(RECORD,TEXT)
*
 HERE = 0
 QUOTED = @FALSE
 RECORD = ''
 LOOP
HERE += 1
C = TEXT[HERE,1]
 UNTIL C EQ ''
BEGIN CASE
   CASE QUOTED AND TEXT[HERE,2] EQ ''
  HERE += 1
   CASE C EQ ''
  QUOTED = NOT(QUOTED)
  C = ''
   CASE C EQ ',' AND NOT QUOTED
  C = @FM
END CASE
RECORD := C
 REPEAT
 RETURN
  END

Regards, Keith

PS: Remember Messrs Stout and Chapman - Simplicate and add more lightness

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] trimming a list (a test of your ability)

2012-07-16 Thread Keith Johnson [DATACOM]
Universe gives a slight lead to -1 too.

Also, it compiles Y = Y:CHAR(254):I and Y := CHAR(254):I to exactly the same 
thing.  I checked with VLIST and even edited the compiled code to be sure.

ALSO (and this surprised me) it doesn't support ROUNDS *= 2

The documenation (Universe BASIC 2-25) only shows plus-equal minus-equal and 
concatenate-equal so I suppose that must be correct. I'm still a little 
shell-shocked, though.

Regards, Keith


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Is there any way to tell if I am in an EXECUTE level and CAPTURING is turned on?

2012-07-03 Thread Keith Johnson [DATACOM]
I just noticed this in the help for QM's SYSTEM()

1000 Returns 1 if EXECUTE CAPTURING is in effect, 0 otherwise

Checked if this was an undocumented feature that Martin had reproduced; but no, 
it doesn't work in Universe.

Regards, Keith



___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


[U2] Exiting UniData

2012-07-03 Thread Keith Johnson [DATACOM]
Hi John,

I'm on an SB+ site on Universe which is completely unrelated to Epicor. Our 
QUIT is an exact copy of SH.OFF, which is a local catalogue pointer to the 
program code.

I believe SH.OFF tidies up various SB+ stuff and then chains to OFF, and that 
this is the standard behaviour of SB+

Regards, Keith

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] RESIZE - dynamic files

2012-07-03 Thread Keith Johnson [DATACOM]
Doug may have had a key bounce in his input

 Let's do the math:

 258687736 (Record Size)
 192283300 (Key Size)
 

The key size is actually 19283300 in Chris' figures

Regarding 68,063 being less than the current modulus of 82,850.  I think the 
answer may lie in the splitting process.

As I understand it, the first time a split occurs group 1 is split and its 
contents are split between new group 1 and new group 2. All the other groups 
effectively get 1 added to their number. The next split is group 3 (which was 
2) into 3 and 4 and so forth. A pointer is kept to say where the next split 
will take place and also to help sort out how to adjust the algorithm to 
identify which group matches a given key.

Based on this, if you started with 1000 groups, by the time you have split the 
500th time you will have 1500 groups.  The first 1000 will be relatively empty, 
the last 500 will probably be overflowed, but not terribly badly.  By the time 
you get to the 1000th split, you will have 2000 groups and they will, one 
hopes, be quite reasonably spread with very little overflow.

So I expect the average access times would drift up and down in a cycle.  The 
cycle time would get longer as the file gets bigger but the worst time would be 
roughly the the same each cycle.

Given the power of two introduced into the algorithm by the before/after the 
split thing, I wonder if there is such a need to start off with a prime?

Regards, Keith

PS I'm getting a bit Tony^H^H^H^Hverbose nowadays.

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Is there any way to tell if I am in an EXECUTE level and CAPTURING is turned on?

2012-06-27 Thread Keith Johnson [DATACOM]
Hi Doug,

Another way to skin the cat-

Check the @LEVEL in the error display program and if it's not 1 use a timed 
input.
Unidata has INPUT WAITING, while for Universe, there is a program do do the 
same at
http://www.pickwiki.com/cgi-bin/wiki.pl?InputWait

Perhaps do the timed input anyway with different times depending on the level?

Regards, Keith



___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Proc question

2012-05-08 Thread Keith Johnson [DATACOM]
Hi Kebbon,

I don't like Procs, but

* Set the primary input buffer as active
SP
* Activate the primary output buffer
STOFF
* Alternatively, clear both output buffers and make the primary the active one
RO
* Set the input buffer pointer to the first (or whatever) parameter
S1
* Move a substring in the that parameter from the active input buffer to the 
end of the active output buffer with no surround character
A\(4,5)


Regards, Keith

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] READU vs READ

2012-05-01 Thread Keith Johnson [DATACOM]
If the multivalues have many many values, and you are adding to the end, then a 
speed up may be possible.

MATREAD in the data, RAISE those array elements you are changing.  Before the 
MATWRITE, LOWER all array elements you raised.

As I understand it, Universe keeps internal track on attributes, so processing 
these in ascending order is a LOT faster than it used to be.  However this is 
not done for multivalues (space considerations?).

Regards, Keith


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] The CONTINUE statement

2012-04-29 Thread Keith Johnson [DATACOM]
Just to be annoyingly pedantic - the second code snippet is missing an END


FOR I = 1 TO X
   do something
   IF some condition THEN CONTINUE
   do something else
NEXT I

Versus

FOR I = 1 TO X
   do something
   IF NOT(some condition) THEN
  do something else
NEXT I




___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] The RETURN TO statement was the CONTINUE statement

2012-04-29 Thread Keith Johnson [DATACOM]
Hi Wil,

They can't do that because then their line editor would break - It has 58 
occurances of RETURN TO


Message: 27
Date: Fri, 27 Apr 2012 08:38:05 -0400 (EDT)
From: Wjhonson wjhon...@aol.com
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] The RETURN TO statement was the CONTINUE statement
Message-ID: 8cef289ba33f8cc-bd4-7...@webmail-m082.sysops.aol.com
Content-Type: text/plain; charset=us-ascii


 Perhaps we could start a petition to get Rocket to state in their 
 documentation
The RETURN TO statement is deprecated and will be forbidden in release 12


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] RETURN TO (again)

2012-04-29 Thread Keith Johnson [DATACOM]
I never used it in anger, but I was rather drawn to the Presley-friendly form

SENDER: RETURN TO SENDER

I actually used the following progam a long time ago, but only to test that 
EQU...LIT... workedhow I thought it did.

Try it - Press T a few times then X and watch it unwind the call stack.


001:  EQU ABANDON LIT 'RETURN TO SENDER'
002:  CRT 'START OF PROGRAM'
003:  GOSUB TEST
004:  CRT 'RETURN FROM TEST'
005:  STOP
006: SENDER:
007:  CRT 'NOW AT SENDER'
008:  ABANDON
009:  CRT 'END OF SENDER'
010:  STOP
011: TEST:
012:  LOOP
013: CRT 'AT TEST ':
014: INPUT BACK,1
015: BACK = UPCASE(BACK)
016: IF BACK EQ 'T' THEN GOSUB TEST
017: IF BACK EQ 'X' THEN ABANDON
018:  WHILE BACK DO
019: CRT 'STILL IN TEST'
020:  REPEAT
021:  CRT 'END OF TEST'
022:  RETURN

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-25 Thread Keith Johnson [DATACOM]
Hi Will,

As I said, I don't use it myself, but a reason one might use
it is that one can easily cut and paste (or include) logic.

For example:
---
LOCKED
  put
  some
  generic
  logic
  here
END
---

regards, Keith


   WJohnson wrote:

   Why the extra lines?  Why not just
   IF A = TEST THEN
  gosub do.something
   END ELSE
  gosub do.something.else
   END

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] EXIT ; EXIT inside a loop

2012-04-23 Thread Keith Johnson [DATACOM]
I think the UNTIL should be in behind NEXT A2, rather than on the FOR line.

Hoping to lighten the day...

   BAIL = 0
   FOR A1 = 1 TO XYZZY
  FOR A2 = 1 TO Y
 little twisted logic
 IF G # H THEN BAIL = 51 ;* error code
  UNTIL BAIL DO
 twisted little logic
  NEXT A2
   UNTIL BAIL DO
   twisting little logic
NEXT A1
   IF BAIL THEN DISPLAY 'Housten, we have a problem in Area ':BAIL

Or use a GOSUB - RETURN does a fair job of being readable.

Regards, Keith


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-23 Thread Keith Johnson [DATACOM]
I prefer the layout of

IF A = TEST
   THEN GOSUB DO.SOMETHING  ;* Say why
   ELSE GOSUB DO.SOMETHING.ELSE ;* The reason

However, here is a form that's rarely used, but does work.

IF A = TEST
THEN ;* say why in a long-winded manner
   GOSUB DO.SOMETHING
END
ELSE ;* the reasoning behind the reason
   GOSUB DO.SOMETHING.ELSE
END

I don't use it myself, but it's very amenable to cut and paste programming.

Regards, Keith

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Detecting idle time in INPUT statement.

2012-03-27 Thread Keith Johnson [DATACOM]
If anyone DOES want the equivalent of Unidata's INPUT... WAITING for Universe...

http://www.pickwiki.com/cgi-bin/wiki.pl?InputWait

Regards, Keith

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Code style ? or code silliness ?

2012-03-25 Thread Keith Johnson [DATACOM]
The examples as given were not equivalent.

THE.READ = STR('0',DIALS-LEN(THE.READ)):THE.READ

versus

THE.JUST = R#:LEN(THE.READ); THE.READ = THE.READ THE.JUST

Apart from the % to # change, the second example ignores DIALS and justifies 
within the length of THE.READ

I assume the second one ought to have been

THE.JUST = R%:DIALS; THE.READ = THE.READ THE.JUST


As the R%n form doesn't always work in Unidata

$DEFINE UNIDATA
|
.
|
* Special subtlety for Unidata not supporting 'R%3' form
$IFDEF UNIDATA
 PFX = ''; SFX = '\0R'
$ELSE
 PFX = 'R%'; SFX = ''
$ENDIF
|
.
|
THE.READ = FMT(THE.READ,PFX:DIALS:SFX)




___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Building an Excel File

2012-02-08 Thread Keith Johnson [DATACOM]
I'm curious; was the university in Florida Barry University?

Someone I worked with years ago went there as a Pick programmer.


The following code might be helpful


 subroutine ucsv(result,source,status,is.oconv)
*
* Public Domain program for OpenQM by Keith Johnson 2012
*
*  OCONV Converts from attribute and value marks to .CSV format
*Attribute marks are converted to CR:LF
*  ICONV Converts from .CSV to delimited form
*If there are no CR:LF sequences, it uses LF
*If there are no LF characters, it uses attribute marks
*
* Usage: To convert ABC to a .CSV format, use code like
*
*NEWABC = OCONV(ABC,'UUCSV')
*
*
 result = ''
 status = 0
 crlf = char(13):char(10)
 test = index(source,crlf,1)
*
 begin case
*
* this is OK
case source = ''
   null
*
* OCONV not OK if there are already CR:LF sequences
case is.oconv and test
   status = 1
*
* The normal case when generating .CSV data
case is.oconv
   atts = dcount(source,@am)
   for attr = 1 to atts
  line = sourceattr
CRT 'line = ':line
  vals = dcount(line,@vm)
  part = ''
  for valu = 1 to vals
 bite = line1,valu
 if part ne '' then part := ','
 good = @true
 if index(bite,'',1) then good = @false
 if index(bite,' ',1) then good = @false
 if index(bite,',',1) then good = @false
 if index(bite,char(10),1) then good = @false
 if index(bite,char(13),1) then good = @false
 if not(good) then
bite = change(bite,'','')
bite = '':bite:''
 end
 part := bite
  next valu
CRT 'part = ':part
  if result eq ''
 then result = part
 else result := crlf:part
   next attr
*
* Cannot have both of these in ICONV file - the rows will change
case index(source,@am,1) and index(source,char(10),1)
   status = 2
*
* converting from standard .CSV file
case test
   flag = @false
   mine = change(source,crlf,@am)
   atts = dcount(mine,@am)
   for attr = 1 to atts
  line = mineattr
  span = len(line)
  part = ''
  for posn = 1 to span
 that = line[posn,2]
 this = that[1,1]
 begin case
case that eq '' and flag
   part :=  ''
   posn += 1
case this eq ''
   flag = not(flag)
case this eq ',' and not(flag)
   part := @vm
case 1
   part := this
 end case
  next posn
  result-1 = part
   next attr
*
* converting from LF only (or possibly @am) row delimited file
case 1
   mark = char(10)
   if not(index(source,mark,1)) then
  mark = @am
  if not(index(source,mark,1)) then
 status = 3
 return
  end
   end
*
   flag = @false
   atts = dcount(source,mark)
   part = ''
   for attr = 1 to atts
  line = field(source,mark,attr)
  span = len(line)
  for posn = 1 to span
 that = line[posn,2]
 this = that[1,1]
 begin case
case that eq '' and flag
   part :=  ''
   posn += 1
case this eq '' and flag
   flag = @false
case this eq ',' and not(flag)
   part := @vm
case 1
   part := this
 end case
  next posn
*
* It is possible to have a linefeed within a field
  if not(flag) then
 result-1 = part:char(10)
 part = ''
  end else
*
* But not an attribute mark when it is the delimiter
* Assume they forgot the last double quote and be nice
 if mark eq @am then
result-1 = part
part = ''
flag = @false
 end
  end
   next attr
 end case
*
 return

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] End of Month date routine

2011-12-06 Thread Keith Johnson [DATACOM]
Mr Castro's code wins. Pure elegance.


Marco Antonio Rojas Castro - initials M.A.R.C.

My uncle's name is Roy Owen Young - I tease him it's so he can remember it.

Regards, Keith




___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] End of Month date routine

2011-12-05 Thread Keith Johnson [DATACOM]
Dave Laansma took a more generic approach which does not require
knowledge of the date format - hence I thought it preferable.

My style would move the addition and subtraction around as below
I assumed one would want the last day of the month for any called date
otherwise uncomment line 2

SUBROUTINE GET.EOM(IDAY)
*IDAY = DATE()
THIS = OCONV(IDAY,'DM')
LOOP
  IDAY += 1
UNTIL OCONV(IDAY,'DM') NE THIS REPEAT
IDAY -= 1
RETURN


Code snippets are fun - copyright not so much.

Regards, Keith


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Changing TCL prompt?

2011-10-05 Thread Keith Johnson [DATACOM]
This program works for Universe on a UNIX machine giving three commands

PATH FULL   would give aprompt like /usr/ibm/uv

PATHwould give a prompt like   uv

PATH CLEAR would give a prompt like   


 PROGRAM PATH

***  Sets or clears the account or path in the TCL prompt
***  so a TCL user doesn't forget where they are.
***
*** MODS:
*** =
*** Seq   DateWho  Reference  Description
*** --- - --- -- ---
*** 001 27 Feb 07 KRJ CC440  Written
***

 SENTENCE = UPCASE(@SENTENCE)
 THIS = '' ; THAT = 1
 BEGIN CASE
CASE INDEX(SENTENCE,'CLEAR',1) ; THAT = 0
CASE INDEX(SENTENCE,'FULL',1)  ; THIS = @PATH:''
CASE 1 ; THIS = FIELD(@PATH,'/',DCOUNT(@PATH,'/')):''
 END CASE
 IF THIS NE '' THEN
THIS2 = THIS1:''
THIS3 = '+'
 END
 ASSIGN THIS TO SYSTEM(4002)
 ASSIGN THAT TO SYSTEM(4001)

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Simple Masking of Password Input (Universe Basic)

2011-08-16 Thread Keith Johnson [DATACOM]
It's not all that simple, but try


http://www.pickwiki.com/cgi-bin/wiki.pl?FieldInput

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] UniBasic SELECT

2011-07-31 Thread Keith Johnson [DATACOM]
The problem may be in the use of program variables in the executed code.

Using Universe, if I have code:

VERB = 'SELECT VOC LIKE A...'
EXECUTE VERB
CRT @SELECTED
CLEARSELECT

I get the result

237 record(s) selected to SELECT list #0.
237

If I change the filename to something that doesn't exit, like VVOC

VERB = 'SELECT vVOC LIKE A...'
EXECUTE VERB
CRT @SELECTED
CLEARSELECT

I get the result

SQL+

Where I have to press Return to get past this and then get

UniVerse/SQL: syntax error.  Unexpected verb.  Token was SELECT.
Scanned command was SELECT
-1

Is F.ICC the name of the file in VOC or only internal to the program?


Regards, Keith.



___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


[U2] LED editor for Universe

2011-05-05 Thread Keith Johnson [DATACOM]
The latest version I use has a copy at 
https://sites.google.com/site/nzpickie/home/programs

It has a BLEACH command to turn colour on and off - named after Brian Leach who 
let me steal his method!
The colour options are based on HostAccess - other terminals have different 
methods.
Modifying this is left as an exercise for the reader -)

Keith

PS  -) is not a smiley, it is a tongue in the cheek.

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Is this worth rewriting?

2011-03-03 Thread Keith Johnson [DATACOM]
I liked Brian's

IF (TEA : EAT : ATE) # '' THEN CUM(M) = TEA + EAT + ATE

It looks neater in VLIST - don't know if it's faster. multi_cat might be a 
beast

2: IF (TEA : EAT : ATE) # '' THEN X = TEA + EAT + ATE
2 00012 : 104 multi_cat  TEA EAT ATE  = $R0
2 0001E : 106 ne $R0   = $R1
2 00026 : 2DE testfw $R1 00040:
2 00030 : 004 addTEA EAT  = $R2
2 00038 : 004 add$R2 ATE  = X


3: IF TEA # '' OR EAT # '' OR ATE # '' THEN X = TEA + EAT + ATE
3 00040 : 106 ne TEA   = $R1
3 00048 : 106 ne EAT   = $R2
3 00050 : 122 or $R1 $R2  = $R3
3 00058 : 106 ne ATE   = $R4
3 00060 : 122 or $R3 $R4  = $R5
3 00068 : 2DE testfw $R5 00080:
3 00070 : 004 addTEA EAT  = $R6
3 00078 : 004 add$R6 ATE  = X


Sorry Chris, it's not exactly the same if you do

IF TEA+EAT+ATE  '' THEN CUM(M) = TEA+EAT+ATE

'cause that's always true.

I had to check the original code a few times because I kept thinking What the 
hey? Surely that's always true?  But it weren't.

Regards, Keith

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Is this worth rewriting?

2011-03-03 Thread Keith Johnson [DATACOM]
Lots of things I didn't think of... My last try

001: MONTHLY.USAGE:
002: CM = MONTH + LY.CNT
003: TEA = RAISE(PARMS(12)101)
004: EAT = RAISE(PARMS(12)133)
005: ATE = RAISE(PARMS(12)134)
006: YAM = RAISE(PARMS(7)100)
007: AMY = RAISE(PARMS(7)101)
008: MYA = RAISE(PARMS(7)102)
009: FOR M = 1 TO 12
010:   A = TEACM ; B = EATCM ; C = ATECM
011:   IF A:B:C NE '' THEN CUM(M) = A+B+C
012:   X = YAMCM ; Y = AMYCM ; Z = MYACM
013:   IF X:Y:Z NE ''THEN
014: IF X EQ '' THEN CUMO(M) += A ELSE CUMO(M) += X
015: IF Y EQ '' THEN CUMO(M) += B ELSE CUMO(M) += Y
016: IF Z EQ '' THEN CUMO(M) += C ELSE CUMO(M) += Z
017:   END
018:   CM -= 1 ; IF CM = 0 THEN CM = 24
019: NEXT M
020: RETURN

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Is this worth rewriting?

2011-03-02 Thread Keith Johnson [DATACOM]
Agreed that the dimensioned extract wouldn't make much difference, still the 
attributes numbers are quite high.

The code below goes from 15 extracts maximum per for-next loop to 6.
I can't help but think this might mean something if it takes 90 minutes to run.

001: MONTHLY.USAGE:
002: CM = MONTH + LY.CNT
003: FOR M = 1 TO 12
004:   TEA = PARMS(12)101,CM
005:   EAT = PARMS(12)133,CM
006:   ATE = PARMS(12)134,CM
007:   IF TEA # '' OR EAT # '' OR ATE # '' THEN CUM(M) = TEA + EAT + ATE
008:   YAM = PARMS(7)100,CM
009:   AMY = PARMS(7)101,CM
010:   MYA = PARMS(7)102,CM
011:   IF YAM # '' OR AMY # '' OR MYA # '' THEN
012: IF YAM # '' THEN CUMO(M) += YAM ELSE CUMO(M) += TEA
013: IF AMY # '' THEN CUMO(M) += AMY ELSE CUMO(M) += EAT
014: IF MYA # '' THEN CUMO(M) += MYA ELSE CUMO(M) += ATE
015:   END
016:   CM -= 1 ; IF CM = 0 THEN CM = 24
017: NEXT M
018: RETURN


So I'd say AYE - or YEA, if you use meaningful variables

Regards, Keith

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] [UV] UniVerse Uptime

2011-02-17 Thread Keith Johnson [DATACOM]
We stop and start the Universe database and do a UNIX backup, so either

ps -e -o etime -o  comm | grep uvdlockd

Or

ps -e -o etime -o  comm | grep unirpcd


Seem to be reasonable ways of seeing how long it's been up

Regards, Keith



___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


RE: [U2] UV Timed INPUT

2009-03-15 Thread Keith Johnson [DATACOM]
David Norman asked for a timed input for Universe.  There is a program
to replicate the Unidata timed input at
http://www.pickwiki.com/cgi-bin/wiki.pl?InputWait
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] DO/WHILE vs IF THEN

2009-03-02 Thread Keith Johnson [DATACOM]
Mark Johnson suggested the following change

Before
GOOD.ANS=FALSE
LOOP UNTIL GOOD.ANS DO
   PRINT ENTER 'Y' OR 'N' :;INPUT ANS
   IF ANS=Y OR ANS=N THEN GOOD.ANS=TRUE REPEAT

after
LOOP WHILE TRUE DO
   PRINT ENTER 'Y' OR 'N' :;INPUT ANS
   IF ANS=Y OR ANS=N THEN EXIT
REPEAT

These forms all work (Universe 10.2.0)  and are progressively shorter
than the above

LOOP
   PRINT ENTER 'Y' OR 'N' :;INPUT ANS
   IF ANS=Y OR ANS=N THEN EXIT
REPEAT


LOOP
   PRINT ENTER 'Y' OR 'N' :;INPUT ANS
UNTIL ANS=Y OR ANS=N DO
REPEAT


LOOP
   PRINT ENTER 'Y' OR 'N' :;INPUT ANS
UNTIL ANS=Y OR ANS=N REPEAT


LOOP PRINT ENTER 'Y' OR 'N' :;INPUT ANS
UNTIL ANS=Y OR ANS=N REPEAT


Ray Wurlod was a great proponent of the LOOP WHILE READNEXT ID format.
I believe it may not compile on some MV systems.


Regards, Keith
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Normal SELECT behavior? [UD]

2008-11-05 Thread Keith Johnson [DATACOM]
LIST POH F1 WITH F1 = 000700

will do a numeric comparison if it can.  You can force a string
comparison by using

LIST POH F1 WITH F1 LIKE '000700'

That is; double quote, single quote, zero, zero, zero, seven, zero,
zero, single quote, double quote.

Regards, Keith
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/