[U2] [UD] PRECISION - not persisting

2006-05-31 Thread Simon Lewington
Unidata 7.1 on Win 2k

The Unibasic PRECISION setting (eg 'PRECISION 6') is not persisting for
called subroutines, but is falling back to its default of 4.

eg
SUBROUTINE TEST
A=24127.14063
B=24127.14062
CRT (A=B)
RETURN

PROGRAM TEST1
PRECISION 6
CALL TEST

This shows '1' showing that PRECISION 4 is being used.  If the PRECISION 6
is moved into TEST, it shows '0'.

I have a suspicion this may have changed at some point prior to UD 6.0.12
(the oldest version I now have) since we have a 'PRECISION 6' in our
initialisation software, and I believe that worked at the time.

Anyone know if there is any UDT.OPTIONS or something setting that I've
missed that will allow the precision to persist for a session rather than
just within a subroutine?

Cheers
Simon
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


[U2] [UD] Precision

2004-11-30 Thread Shawn Waldie
I need some help from you payroll pros out here.

Background:
I've developed a subroutine that will read an externally-maintained
dir-type file (insurance prem. table) for every employee when payroll is
run.

This table contains monthly insurance premiums for different types of
covereage, i.e.,
27748   64074   76278
29236   68088   80620
33368   75076   89396
538 10161494
178822772342
The OCONV() for these is MD2.
The subroutine will find the appropriate premium in this table based on
other criteria.


Pertinent part:

-Based on the employees' salary, the employer will pay either 80, 70, or
60 percent of this premium; with the employee
 paying the difference.
-The Paychecks are issued semi-monthly.



Here's my logic so far:

MO.PREM = PREM.TBLX,Y

BEGIN CASE
  CASE X.SALARY LT 3; * Employer pays 80%
X.EMPLYR.AMT = MO.PREM * 8 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE ((X.SALARY GE 3) AND (X.SALARY LT 4)); * Employer pays
70%
X.EMPLYR.AMT = MO.PREM * 7 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE X.SALARY GE 4; * Employer pays 60%
X.EMPLYR.AMT = MO.PREM * 6 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE 1
END CASE

* Divide these amounts by two since since employees are payed twice per
month.
X.EMPLYR.AMT = X.EMPLYR.AMT / 2
X.EMPLYE.AMT = X.EMPLYE.AMT / 2

This is all working out satisfactorily, but I want to ensure that the
accounting folks are happy at the end of the year, so I need something a
little more rigorous.

The internal format of X.EMPLYR.AMT  X.EMPLYE.AMT that is returned to
the calling process must be such that if viewed 'externally', the
conversion would MD2

For example, if the monthly premium is 425
Monthly premium: $425
Employer (mo)..:  340 - 80%
Employee (mo)..:   85 - 20%

Per check -
Employer: $170
Employee:   42.50

X.EMPLYR.AMT = 17000
X.EMPLYE.AMT =  4250




Suggestions welcome!

* Shawn WaldieSan Juan College *
* Programmer/Analyst 4601 College Blvd *
* Phone: (505)566-3072   Farmington, NM  87402 *
*  email: [EMAIL PROTECTED]   *

---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UD] Precision

2004-11-30 Thread Derek Falkner
Shawn,

Any time you divide an integer number of cents you may end up with a
fraction of a cent. I would use the INT() function like this:

X.EMPLYR.AMT = INT(MO.PREM * 0.8)
and
X.EMPLYE.AMT = INT(X.EMPLYR.AMT / 2) 
X.EMPLYR.AMT = X.EMPLYR.AMT - X.EMPLYE.AMT

I hope that helps!

Derek Falkner
Kingston, Ontario, Canada


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Shawn Waldie
Sent: Tuesday, November 30, 2004 2:24 PM
To: [EMAIL PROTECTED]
Subject: [U2] [UD] Precision

I need some help from you payroll pros out here.

snip

-Based on the employees' salary, the employer will pay either 80, 70, or 60
percent of this premium; with the employee  paying the difference. -The
Paychecks are issued semi-monthly.

Here's my logic so far:

MO.PREM = PREM.TBLX,Y

BEGIN CASE
  CASE X.SALARY LT 3 ; * Employer pays 80%
X.EMPLYR.AMT = MO.PREM * 8 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE ((X.SALARY GE 3) AND (X.SALARY LT 4)) ; * Employer pays 70%
X.EMPLYR.AMT = MO.PREM * 7 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE X.SALARY GE 4 ; * Employer pays 60%
X.EMPLYR.AMT = MO.PREM * 6 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE 1
END CASE

* Divide these amounts by two since since employees are payed twice per
month. 
X.EMPLYR.AMT = X.EMPLYR.AMT / 2 
X.EMPLYE.AMT = X.EMPLYE.AMT / 2

snip

Suggestions welcome!

* Shawn WaldieSan Juan College *
* Programmer/Analyst 4601 College Blvd *
* Phone: (505)566-3072   Farmington, NM  87402 *
*  email: [EMAIL PROTECTED]   *

---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UD] Precision

2004-11-30 Thread Kevin King
Define a little more rigorous?  Other than some rounding/truncation
issues, what exactly are you going for? 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Shawn Waldie
Sent: Tuesday, November 30, 2004 12:24 PM
To: [EMAIL PROTECTED]
Subject: [U2] [UD] Precision

I need some help from you payroll pros out here.

Background:
I've developed a subroutine that will read an externally-maintained
dir-type file (insurance prem. table) for every employee when payroll
is run.

This table contains monthly insurance premiums for different types of
covereage, i.e.,
27748   64074   76278
29236   68088   80620
33368   75076   89396
538 10161494
178822772342
The OCONV() for these is MD2.
The subroutine will find the appropriate premium in this table based
on other criteria.


Pertinent part:

-Based on the employees' salary, the employer will pay either 80, 70,
or 60 percent of this premium; with the employee  paying the
difference.
-The Paychecks are issued semi-monthly.



Here's my logic so far:

MO.PREM = PREM.TBLX,Y

BEGIN CASE
  CASE X.SALARY LT 3; * Employer pays 80%
X.EMPLYR.AMT = MO.PREM * 8 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE ((X.SALARY GE 3) AND (X.SALARY LT 4)); * Employer pays
70%
X.EMPLYR.AMT = MO.PREM * 7 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE X.SALARY GE 4; * Employer pays 60%
X.EMPLYR.AMT = MO.PREM * 6 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE 1
END CASE

* Divide these amounts by two since since employees are payed twice
per month.
X.EMPLYR.AMT = X.EMPLYR.AMT / 2
X.EMPLYE.AMT = X.EMPLYE.AMT / 2

This is all working out satisfactorily, but I want to ensure that the
accounting folks are happy at the end of the year, so I need something
a little more rigorous.

The internal format of X.EMPLYR.AMT  X.EMPLYE.AMT that is returned to
the calling process must be such that if viewed 'externally', the
conversion would MD2

For example, if the monthly premium is 425 Monthly premium: $425
Employer (mo)..:  340 - 80%
Employee (mo)..:   85 - 20%

Per check -
Employer: $170
Employee:   42.50

X.EMPLYR.AMT = 17000
X.EMPLYE.AMT =  4250




Suggestions welcome!

* Shawn WaldieSan Juan College *
* Programmer/Analyst 4601 College Blvd *
* Phone: (505)566-3072   Farmington, NM  87402 *
*  email: [EMAIL PROTECTED]   *

---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UD] Precision

2004-11-30 Thread Allen E. Elwood
Hi Shawn,

Everything looks good, but what is the question?  i.e., explain what you
mean by a little more rigorous.

i.e.i.e. you need to do ?what? to the data to satisfy the accountants...

Allen

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Shawn Waldie
Sent: Tuesday, November 30, 2004 11:24
To: [EMAIL PROTECTED]
Subject: [U2] [UD] Precision


I need some help from you payroll pros out here.

Background:
I've developed a subroutine that will read an externally-maintained
dir-type file (insurance prem. table) for every employee when payroll is
run.

This table contains monthly insurance premiums for different types of
covereage, i.e.,
27748   64074   76278
29236   68088   80620
33368   75076   89396
538 10161494
178822772342
The OCONV() for these is MD2.
The subroutine will find the appropriate premium in this table based on
other criteria.


Pertinent part:

-Based on the employees' salary, the employer will pay either 80, 70, or
60 percent of this premium; with the employee
 paying the difference.
-The Paychecks are issued semi-monthly.



Here's my logic so far:

MO.PREM = PREM.TBLX,Y

BEGIN CASE
  CASE X.SALARY LT 3; * Employer pays 80%
X.EMPLYR.AMT = MO.PREM * 8 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE ((X.SALARY GE 3) AND (X.SALARY LT 4)); * Employer pays
70%
X.EMPLYR.AMT = MO.PREM * 7 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE X.SALARY GE 4; * Employer pays 60%
X.EMPLYR.AMT = MO.PREM * 6 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE 1
END CASE

* Divide these amounts by two since since employees are payed twice per
month.
X.EMPLYR.AMT = X.EMPLYR.AMT / 2
X.EMPLYE.AMT = X.EMPLYE.AMT / 2

This is all working out satisfactorily, but I want to ensure that the
accounting folks are happy at the end of the year, so I need something a
little more rigorous.

The internal format of X.EMPLYR.AMT  X.EMPLYE.AMT that is returned to
the calling process must be such that if viewed 'externally', the
conversion would MD2

For example, if the monthly premium is 425
Monthly premium: $425
Employer (mo)..:  340 - 80%
Employee (mo)..:   85 - 20%

Per check -
Employer: $170
Employee:   42.50

X.EMPLYR.AMT = 17000
X.EMPLYE.AMT =  4250




Suggestions welcome!

* Shawn WaldieSan Juan College *
* Programmer/Analyst 4601 College Blvd *
* Phone: (505)566-3072   Farmington, NM  87402 *
*  email: [EMAIL PROTECTED]   *

---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UD] Precision

2004-11-30 Thread Don Verhagen
Maybe they are paid semi-monthly (24 periods) rather than Bi-weekly (26 
periods).

--
Donald Verhagen  
Application Development Manager
[EMAIL PROTECTED]
Tandem Staffing Solutions, Inc.
1690 S Congress Avenue, Suite 210
Delray Beach, FL 33445  USA
Voice Phone: 561.454.3592 Fax Phone: 561.454.3640 

 [EMAIL PROTECTED] 3:52:25 PM 11/30/2004 
52/2 = 26 paychecks ?
2 * 12 = 24 paychecks 
where the 2 missing paychecks ?  

This e-mail, including attachments, may include confidential and/or 
proprietary information, and may be used only by the person or entity to 
which it is addressed. If the reader of this e-mail is not the intended 
recipient or his or her authorized agent, the reader is hereby notified 
that any dissemination, distribution or copying of this e-mail is 
prohibited. If you have received this e-mail in error, please notify the 
sender by replying to this message and delete this e-mail immediately.
---
u2-users mailing list
[EMAIL PROTECTED] 
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UD] Precision

2004-11-30 Thread Kevin Sheperdson
Congratulations Gyle.
This is exactly how it should be done to keep everything balanced. Semi
monthly = 24 pays per year. fortnightly (every 2 weeks) indicates usually 26
or occasionally 27 pays per year.
Regards Kevin Shepherdson

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Gyle Iverson
Sent: Wednesday, December 01, 2004 7:44 AM
To: [EMAIL PROTECTED]
Subject: RE: [U2] [UD] Precision


Hello, Shawn.

There are some odd cent differences to account for in the monthly amount
calculations. I used the Iconv() function to round the fractional cents.

employerMonthlyAmount = IConv( monthlyAmount * percentage, MD0 )
employeeMonthlyAmount = monthlyAmount - employerMonthlyAmount

For the semi-monthly amounts, these need to account for the odd cent too.
Use some function of the pay date to know if you are processing the first or
second pay period.

employerSemiAmount = IConv( employerMonthlyAmount / 2, MD0 )
employeeSemiAmount = IConv( employeeMonthlyAmount / 2, MD0 )
If firstOfMonth Then
   employerSemiAmount = employerMonthlyAmount - employerSemiAmount
   employeeSemiAmount = employeeMonthlyAmount - employeeSemiAmount
End

Best regards,
Gyle

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Shawn Waldie
Sent: Tuesday, November 30, 2004 11:24 AM
To: [EMAIL PROTECTED]
Subject: [U2] [UD] Precision


I need some help from you payroll pros out here.

Background:
I've developed a subroutine that will read an externally-maintained
dir-type file (insurance prem. table) for every employee when
payroll is
run.

This table contains monthly insurance premiums for different types of
covereage, i.e.,
27748  64074   76278
29236  68088   80620
33368  75076   89396
53810161494
1788   22772342
The OCONV() for these is MD2.
The subroutine will find the appropriate premium in this table based on
other criteria.


Pertinent part:

-Based on the employees' salary, the employer will pay either
80, 70, or
60 percent of this premium; with the employee
 paying the difference.
-The Paychecks are issued semi-monthly.



Here's my logic so far:

MO.PREM = PREM.TBLX,Y

BEGIN CASE
  CASE X.SALARY LT 3; * Employer pays 80%
X.EMPLYR.AMT = MO.PREM * 8 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE ((X.SALARY GE 3) AND (X.SALARY LT 4)); * Employer pays
70%
X.EMPLYR.AMT = MO.PREM * 7 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE X.SALARY GE 4; * Employer pays 60%
X.EMPLYR.AMT = MO.PREM * 6 / 10
X.EMPLYE.AMT = MO.PREM - X.EMPLYR.AMT
  CASE 1
END CASE

* Divide these amounts by two since since employees are payed twice per
month.
X.EMPLYR.AMT = X.EMPLYR.AMT / 2
X.EMPLYE.AMT = X.EMPLYE.AMT / 2

This is all working out satisfactorily, but I want to ensure that the
accounting folks are happy at the end of the year, so I need
something a
little more rigorous.

The internal format of X.EMPLYR.AMT  X.EMPLYE.AMT that is returned to
the calling process must be such that if viewed 'externally', the
conversion would MD2

For example, if the monthly premium is 425
Monthly premium: $425
Employer (mo)..:  340 - 80%
Employee (mo)..:   85 - 20%

Per check -
Employer: $170
Employee:   42.50

X.EMPLYR.AMT = 17000
X.EMPLYE.AMT =  4250




Suggestions welcome!

* Shawn WaldieSan Juan College *
* Programmer/Analyst 4601 College Blvd *
* Phone: (505)566-3072   Farmington, NM  87402 *
*  email: [EMAIL PROTECTED]   *

---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UD] Precision

2004-11-30 Thread Shawn Waldie
My thanks to all for the responses.

Shawn

-Original Message-
From: Shawn Waldie 
Sent: Tuesday, November 30, 2004 1:37 PM
To: [EMAIL PROTECTED]
Subject: RE: [U2] [UD] Precision


I see a strong potential for penny-creep here unless I add/truncate
some zeros before/after I make calculations.  I would like to minimize
this as much as possible; and I thought there might be a
convention/standard that others are using.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/