[U2] list DICT uniObjects

2009-07-14 Thread Edwin Maluleke
Hi,

I am trying to read and list the dictionary of a file on a dataGrid vb.net 
express 2008. I am using the uniObjects framework/library. I just can't seem 
to find my way round it. Please help

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


Re: [U2] list DICT uniObjects

2009-07-14 Thread Brian Leach
Edwin

Two ways to do this:

The quick/dirty and frankly not very good way is to use UniXML:

  private DataSet ds;
private Boolean showDict(String fileName, UniSession sess,
DataGridView dg) {
UniXML xml = sess.CreateUniXML();
xml.GenerateXML(SORT DICT  + fileName);
ds = xml.GetDataSet();
dg.AutoGenerateColumns = true;
dg.DataSource = ds.Tables[0];
return true;
}

The better way is create a DictItem class to hold the dictionary elements,
e.g.

class DictItem{
  private String _id = String.Empty;
  private String _type = String.Empty;
  private Int32 _fno = 0;
  (etc)
  public String Id{
   get { return _id; }
   set { _id = value; }
  }
  (etc)
}

You can then populate a ListDictItem by reading each one from the
dictionary, and set that as the data source for the grid.

private ListDictItem list = new ListDictItem();
private Boolean showDict(String fileName, UniSession sess,
DataGridView dg){


UniFile dict = sess.CreateUniFile(DICT  + fileName);
UniSelectList sel = sess.CreateUniSelectList(0);
sel.Select(dict);
while (sel.LastRecordRead == false) {
String id = sel.Next();
if (String.IsNullOrEmpty(id) == false) {
UniDynArray dictRec = dict.Read(id);
DictItem item = new DictItem();
item.Id = id;
item.Type = dictRec.Extract(1).StringValue;
// etc
list.Add(item);
}
}

dg.DataSource = list;
return true;
}


Brian

 -Original Message-
 From: u2-users-boun...@listserver.u2ug.org 
 [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of 
 Edwin Maluleke
 Sent: 14 July 2009 10:48
 To: u2-users@listserver.u2ug.org
 Subject: [U2] list DICT uniObjects
 
 Hi,
 
 I am trying to read and list the dictionary of a file on a 
 dataGrid vb.net express 2008. I am using the uniObjects 
 framework/library. I just can't seem to find my way round it. 
 Please help
 
 ___
 U2-Users mailing list
 U2-Users@listserver.u2ug.org
 http://listserver.u2ug.org/mailman/listinfo/u2-users
 

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


Re: [U2] list DICT uniObjects

2009-07-14 Thread Brian Leach
Edwin

Sorry, missed the bit about it being in VB.

Here goes again:

A) using UniXML

Private ds As DataSet
Private Function showDict(ByVal fileName As String, ByVal sess As
UniSession, ByVal dg As DataGridView) As Boolean
Dim xml As UniXML = sess.CreateUniXML()
xml.GenerateXML(SORT DICT  + fileName)
ds = xml.GetDataSet()
dg.AutoGenerateColumns = True
dg.DataSource = ds.Tables(0)
Return True
End Function

B) Using a List(Of DictItem)

Private list As List(Of DictItem) = New List(Of DictItem)
Private Function showDict2(ByVal fileName As String, ByVal sess As
UniSession, ByVal dg As DataGridView) As Boolean
Dim dict As UniFile = sess.CreateUniFile(DICT  + fileName)

Dim sel As UniSelectList = sess.CreateUniSelectList(0)
sel.Select(dict)
Do While sel.LastRecordRead = False
Dim id As String = sel.Next

If String.IsNullOrEmpty(id) = False Then
Dim dictRec As UniDynArray = dict.Read(id)
Dim item As DictItem = New DictItem()
item.Id = id
item.Type = dictRec.Extract(1).StringValue
' etc
list.Add(item)
End If
Loop

dg.DataSource = list
Return True
End Function

Where:

Class DictItem
Private _id As String = String.Empty
Private _type As String = String.Empty
Private _fno As Int32 = 0
(etc)

Public Property Id()
Get
Return _id
End Get
Set(ByVal value)
_id = value
End Set
End Property

Public Property Type()
Get
Return _type
End Get
Set(ByVal value)
_type = value
End Set
End Property

(etc)

End Class 


Brian

 -Original Message-
 From: u2-users-boun...@listserver.u2ug.org 
 [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brian Leach
 Sent: 14 July 2009 12:30
 To: 'U2 Users List'
 Subject: Re: [U2] list DICT uniObjects
 
 Edwin
 
 Two ways to do this:
 
 The quick/dirty and frankly not very good way is to use UniXML:
 
 private DataSet ds;
 private Boolean showDict(String fileName, UniSession 
 sess, DataGridView dg) {
 UniXML xml = sess.CreateUniXML();
 xml.GenerateXML(SORT DICT  + fileName);
 ds = xml.GetDataSet();
 dg.AutoGenerateColumns = true;
 dg.DataSource = ds.Tables[0];
 return true;
 }
 
 The better way is create a DictItem class to hold the 
 dictionary elements, e.g.
 
 class DictItem{
   private String _id = String.Empty;
   private String _type = String.Empty;
   private Int32 _fno = 0;
   (etc)
   public String Id{
get { return _id; }
set { _id = value; }
   }
   (etc)
 }
 
 You can then populate a ListDictItem by reading each one 
 from the dictionary, and set that as the data source for the grid.
 
 private ListDictItem list = new ListDictItem();
 private Boolean showDict(String fileName, UniSession 
 sess, DataGridView dg){
 
 
 UniFile dict = sess.CreateUniFile(DICT  + fileName);
 UniSelectList sel = sess.CreateUniSelectList(0);
 sel.Select(dict);
 while (sel.LastRecordRead == false) {
 String id = sel.Next();
 if (String.IsNullOrEmpty(id) == false) {
 UniDynArray dictRec = dict.Read(id);
 DictItem item = new DictItem();
 item.Id = id;
 item.Type = dictRec.Extract(1).StringValue;
 // etc
 list.Add(item);
 }
 }
 
 dg.DataSource = list;
 return true;
 }
 
 
 Brian
 
  -Original Message-
  From: u2-users-boun...@listserver.u2ug.org
  [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Edwin 
  Maluleke
  Sent: 14 July 2009 10:48
  To: u2-users@listserver.u2ug.org
  Subject: [U2] list DICT uniObjects
  
  Hi,
  
  I am trying to read and list the dictionary of a file on a dataGrid 
  vb.net express 2008. I am using the uniObjects framework/library. I 
  just can't seem to find my way round it.
  Please help
  
  ___
  U2-Users mailing list
  U2-Users@listserver.u2ug.org
  http://listserver.u2ug.org/mailman/listinfo/u2-users
  
 
 ___
 U2-Users mailing list
 U2-Users@listserver.u2ug.org
 http://listserver.u2ug.org/mailman/listinfo/u2-users
 

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


[U2] Trans() to a subroutine I descriptor

2009-07-14 Thread Jeff Schasny
Is it possible to have an I descriptor which does a TRANS() to an I 
descriptor in another file which is a subroutine?

For some reason mine wont compile.

Original I descriptor in file GM.SHF:
01 ED DICT GM.SHF TURNS
This is a Type I Descriptor last compiled on 07/14/09 at 08:49.
20 lines long.

: P7
0001: I
0002: SUBR('*CALC.TURNS',@ID)
0003:
0004: TURNS
0005: 7R
0006: S

Trans I descriptor in GM.GMF:

ED DICT GM.GMF TURNS
This Type I Descriptor must be compiled before use.
14 lines long.

: P7
0001: I
0002: TRANS(GM.SHF,SMF.LINK,TURNS,'X')
0003:
0004: TURNS
0005: 7R
0006: S
0007:

When I run a list statement:

LIST GM.GMF TURNS
Compiling TURNS.
TRANS ( GM.SHF , ( @ID : .1 ) , TURNS syntax error

I-descriptor TURNS was not compiled.


--

Jeff Schasny - Denver, Co, USA
jschasny at gmail dot com

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


Re: [U2] Trans() to a subroutine I descriptor

2009-07-14 Thread Charles Stevenson

Sorry, Jeff, you can't.  Best you can do is:

  DICT GM.GMF TURNS
  0001: I
  0002: SUBR('*CALC.TURNS',SMF.LINK)
   0003:
   0004: TURNS
   0005: 7R
   0006: S

I've always considered it a serious shortcoming.  Theoretically it ought 
to be possible.
It was a shortcoming for Prime, but UV  UD have both perpetuated it. 
(How about QM?)  That suggests technical difficulties beyond my ken.
I'd like to hear guys like Clif Oliver, Glenn Herbert, Dave Meeks,  
Martin Phillips tell us their perspectives.


Chuck Stevenson
Jeff Schasny wrote:
Is it possible to have an I descriptor which does a TRANS() to an I 
descriptor in another file which is a subroutine?

For some reason mine wont compile.

Original I descriptor in file GM.SHF:
01 ED DICT GM.SHF TURNS
This is a Type I Descriptor last compiled on 07/14/09 at 08:49.
20 lines long.

: P7
0001: I
0002: SUBR('*CALC.TURNS',@ID)
0003:
0004: TURNS
0005: 7R
0006: S

Trans I descriptor in GM.GMF:

ED DICT GM.GMF TURNS
This Type I Descriptor must be compiled before use.
14 lines long.

: P7
0001: I
0002: TRANS(GM.SHF,SMF.LINK,TURNS,'X')
0003:
0004: TURNS
0005: 7R
0006: S
0007:

When I run a list statement:

LIST GM.GMF TURNS
Compiling TURNS.
TRANS ( GM.SHF , ( @ID : .1 ) , TURNS syntax error

I-descriptor TURNS was not compile

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


Re: [U2] Trans() to a subroutine I descriptor

2009-07-14 Thread David A. Green
You can't TRANS to an I-Desc. [ad] unless you have my ITRANS
subroutine.[/ad]

Thanks,
David A. Green
www.dagconsulting.com
(480) 813-1725


-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jeff Schasny
Sent: Tuesday, July 14, 2009 10:04 AM
To: U2-Users@listserver.u2ug.org
Subject: [U2] Trans() to a subroutine I descriptor

Is it possible to have an I descriptor which does a TRANS() to an I 
descriptor in another file which is a subroutine?
For some reason mine wont compile.

Original I descriptor in file GM.SHF:
01 ED DICT GM.SHF TURNS
This is a Type I Descriptor last compiled on 07/14/09 at 08:49.
20 lines long.

: P7
0001: I
0002: SUBR('*CALC.TURNS',@ID)
0003:
0004: TURNS
0005: 7R
0006: S

Trans I descriptor in GM.GMF:

 ED DICT GM.GMF TURNS
This Type I Descriptor must be compiled before use.
14 lines long.

: P7
0001: I
0002: TRANS(GM.SHF,SMF.LINK,TURNS,'X')
0003:
0004: TURNS
0005: 7R
0006: S
0007:

When I run a list statement:

 LIST GM.GMF TURNS
Compiling TURNS.
TRANS ( GM.SHF , ( @ID : .1 ) , TURNS syntax error

I-descriptor TURNS was not compiled.


-- 

Jeff Schasny - Denver, Co, USA
jschasny at gmail dot com

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

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


Re: [U2] Trans() to a subroutine I descriptor

2009-07-14 Thread Kathleene M Hunter
TRY

TRANS(GM.SHF,SMF.LINK, SUBR('*CALC.TURNS',@ID),'X')



-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jeff Schasny
Sent: Tuesday, July 14, 2009 10:04 AM
To: U2-Users@listserver.u2ug.org
Subject: [U2] Trans() to a subroutine I descriptor

Is it possible to have an I descriptor which does a TRANS() to an I 
descriptor in another file which is a subroutine?
For some reason mine wont compile.

Original I descriptor in file GM.SHF:
01 ED DICT GM.SHF TURNS
This is a Type I Descriptor last compiled on 07/14/09 at 08:49.
20 lines long.

: P7
0001: I
0002: SUBR('*CALC.TURNS',@ID)
0003:
0004: TURNS
0005: 7R
0006: S

Trans I descriptor in GM.GMF:

 ED DICT GM.GMF TURNS
This Type I Descriptor must be compiled before use.
14 lines long.

: P7
0001: I
0002: TRANS(GM.SHF,SMF.LINK,TURNS,'X')
0003:
0004: TURNS
0005: 7R
0006: S
0007:

When I run a list statement:

 LIST GM.GMF TURNS
Compiling TURNS.
TRANS ( GM.SHF , ( @ID : .1 ) , TURNS syntax error

I-descriptor TURNS was not compiled.


-- 

Jeff Schasny - Denver, Co, USA
jschasny at gmail dot com

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

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


Re: [U2] Trans() to a subroutine I descriptor

2009-07-14 Thread DAVID WADEMAN
Is there the ID of GM.SHF in GM.GMF file? If so then you could used:

ED DICT GM.GMF TURNS
This Type I Descriptor must be compiled before use.
14 lines long.

: P7
0001: I
0002: SUBR('*CALC.TURNS',GMF.SHF.ID)
0003:
0004: TURNS
0005: 7R
0006: S
0007:

Also, stated in another reply, you cannot TRANS to and IDESC, only to a
data element.


-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jeff Schasny
Sent: Tuesday, July 14, 2009 1:04 PM
To: U2-Users@listserver.u2ug.org
Subject: [U2] Trans() to a subroutine I descriptor

Is it possible to have an I descriptor which does a TRANS() to an I 
descriptor in another file which is a subroutine?
For some reason mine wont compile.

Original I descriptor in file GM.SHF:
01 ED DICT GM.SHF TURNS
This is a Type I Descriptor last compiled on 07/14/09 at 08:49.
20 lines long.

: P7
0001: I
0002: SUBR('*CALC.TURNS',@ID)
0003:
0004: TURNS
0005: 7R
0006: S

Trans I descriptor in GM.GMF:

 ED DICT GM.GMF TURNS
This Type I Descriptor must be compiled before use.
14 lines long.

: P7
0001: I
0002: TRANS(GM.SHF,SMF.LINK,TURNS,'X')
0003:
0004: TURNS
0005: 7R
0006: S
0007:

When I run a list statement:

 LIST GM.GMF TURNS
Compiling TURNS.
TRANS ( GM.SHF , ( @ID : .1 ) , TURNS syntax error

I-descriptor TURNS was not compiled.


-- 

Jeff Schasny - Denver, Co, USA
jschasny at gmail dot com

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


[U2] OT: A New Programming Language

2009-07-14 Thread Karl Pearson
FYI:

http://compsoc.dur.ac.uk/whitespace/index.php



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


Re: [U2] Trans() to a subroutine I descriptor

2009-07-14 Thread Charles Stevenson
DAVID WADEMAN wrote: 
 Is there the ID of GM.SHF in GM.GMF file? If so then you could used:

 ED DICT GM.GMF TURNS  
 0001: I
 0002: SUBR('*CALC.TURNS',GMF.SHF.ID)



Jeff's originally attempted

  TRANS(GM.SHF,SMF.LINK,TURNS,'X')

implies that DICT GM.GMF SMF.LINK is the foreign key to the 
corresponding GM.SHF record.

That's why I said that the proper I descriptor will be

  DICT GM.GMF TURNS
  01: I
  02: CALL( '*CALC.TURNS', SMF.LINK )

That assumes that CALC.TURNS doesn't do something like assume @RECORD 
contains the current GM.SHF record.


If it does, it will need to be altered to pass the record as an 
argument, instead/

Then you'd use it in 2 I-descriptors as:

  DICT  GM.SHF  TURNS
  01: I
  02: SUBR( '*CALC.TURNS', @ID, @RECORD )

  DICT GM.GMF  TURNS
  01: I
  02: SUBR( '*CALC.TURNS', SMF.LINK, RAISE(TRANS( GM.SHF, SMF.LINK, 
-1,'X')))


The -1 trans arg means return the whole record.
The RAISE() is because TRANS() automatically lowers all delimiters a 
notch. (Why that is, is for another thread.)



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


Re: [U2] OT: A New Programming Language

2009-07-14 Thread Steve Romanow

Karl Pearson wrote:

FYI:

http://compsoc.dur.ac.uk/whitespace/index.php



___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
  
But is it i18n compliant?  This will be boon for people who have a real 
aversion to showing their code :)


Security by obscurity.

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


Re: [U2] Trans() to a subroutine I descriptor

2009-07-14 Thread Jeff Schasny
The CALC.TURNS routine does not use @record. However, when I create the 
following subroutine call I type in DICT GM.GMF it returns all zeros.


ED DICT GM.GMF TURNS
This is a Type I Descriptor last compiled on 07/14/09 at 14:21.
20 lines long.

: P7
0001: I
0002: SUBR(CALC.TURNS,SMF.LINK)
0003:
0004: TURNS
0005: 7R
0006: S
0007:

So I thought well, maybe SMF.LINK is not creating the correct keys for 
the GM.SHF so I tried:


LIST GM.GMF SMF.LINK
LIST GM.GMF SMF.LINK 02:24:22pm 14 Jul 2009 PAGE 1
GM.GMF SMF LINK...

5614862 5614862.1
5269563 5269563.1
6110292 6110292.1
5164474 5164474.1
5599851 5599851.1
5840059 5840059.1
5990189 5990189.1
4894240 4894240.1
6095281 6095281.1

OK, those are the right keys. Heres the program code:

0006: OPEN 'GM.SHF' TO GM.SHF.FILE ELSE
0007: TURNS = 0
0008: RETURN
0009: END
0010: READ REC FROM GM.SHF.FILE,GM.SHF.ID ELSE
0011: TURNS = 0
0012: RETURN
0013: END
0014:
0015: BEGIN.ON.HAND = REC61
0016: SALES = REC63
0017: END.ON.HAND = REC64
0018: RETURNS = REC67
0019: NUM.PERIODS = DCOUNT(REC63,@VM)
0020:
0021: AVG.INV = (BEGIN.ON.HAND1,1 + SUM(END.ON.HAND)) / (NUM.PERIODS +
1)
0022: IF NUM.PERIODS # 0 THEN
0023: TOT.SALES = ((SUM(SALES) - SUM(RETURNS)) * (52 / NUM.PERIODS))
0024: END ELSE
0025: TURNS = 0
0026: RETURN
0027: END
0028: IF AVG.INV # 0 AND NUM.PERIODS # 0 THEN
0029: TURNS = OCONV(ICONV(100*(TOT.SALES/AVG.INV),'MD0'),'MD2')
0030: END ELSE
0031: TURNS = 0
0032: END
0033:
0034: RETURN

Anyone have any ideas?



Charles Stevenson wrote:
DAVID WADEMAN wrote:  Is there the ID of GM.SHF in GM.GMF file? If so 
then you could used:
  ED DICT GM.GMF TURNS  0001: I  0002: 
SUBR('*CALC.TURNS',GMF.SHF.ID)



Jeff's originally attempted

TRANS(GM.SHF,SMF.LINK,TURNS,'X')

implies that DICT GM.GMF SMF.LINK is the foreign key to the 
corresponding GM.SHF record.

That's why I said that the proper I descriptor will be

DICT GM.GMF TURNS
01: I
02: CALL( '*CALC.TURNS', SMF.LINK )

That assumes that CALC.TURNS doesn't do something like assume @RECORD 
contains the current GM.SHF record.


If it does, it will need to be altered to pass the record as an 
argument, instead/

Then you'd use it in 2 I-descriptors as:

DICT GM.SHF TURNS
01: I
02: SUBR( '*CALC.TURNS', @ID, @RECORD )

DICT GM.GMF TURNS
01: I
02: SUBR( '*CALC.TURNS', SMF.LINK, RAISE(TRANS( GM.SHF, SMF.LINK, 
-1,'X')))


The -1 trans arg means return the whole record.
The RAISE() is because TRANS() automatically lowers all delimiters a 
notch. (Why that is, is for another thread.)



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



--

Jeff Schasny - Denver, Co, USA
jschasny at gmail dot com

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


Re: [U2] Trans() to a subroutine I descriptor

2009-07-14 Thread Steve Romanow
Since your using TURNS=0 for all error conditions, you cannot tell which 
exit your taking.  Why not make each failure a different negative 
number, so you can see.  Maybe it failing the open, maybe the next.  
Return -1, -2, -3, etc.


Jeff Schasny wrote:
The CALC.TURNS routine does not use @record. However, when I create 
the following subroutine call I type in DICT GM.GMF it returns all zeros.


ED DICT GM.GMF TURNS
This is a Type I Descriptor last compiled on 07/14/09 at 14:21.
20 lines long.

: P7
0001: I
0002: SUBR(CALC.TURNS,SMF.LINK)
0003:
0004: TURNS
0005: 7R
0006: S
0007:

So I thought well, maybe SMF.LINK is not creating the correct keys for 
the GM.SHF so I tried:


LIST GM.GMF SMF.LINK
LIST GM.GMF SMF.LINK 02:24:22pm 14 Jul 2009 PAGE 1
GM.GMF SMF LINK...

5614862 5614862.1
5269563 5269563.1
6110292 6110292.1
5164474 5164474.1
5599851 5599851.1
5840059 5840059.1
5990189 5990189.1
4894240 4894240.1
6095281 6095281.1

OK, those are the right keys. Heres the program code:

0006: OPEN 'GM.SHF' TO GM.SHF.FILE ELSE
0007: TURNS = 0
0008: RETURN
0009: END
0010: READ REC FROM GM.SHF.FILE,GM.SHF.ID ELSE
0011: TURNS = 0
0012: RETURN
0013: END
0014:
0015: BEGIN.ON.HAND = REC61
0016: SALES = REC63
0017: END.ON.HAND = REC64
0018: RETURNS = REC67
0019: NUM.PERIODS = DCOUNT(REC63,@VM)
0020:
0021: AVG.INV = (BEGIN.ON.HAND1,1 + SUM(END.ON.HAND)) / (NUM.PERIODS +
1)
0022: IF NUM.PERIODS # 0 THEN
0023: TOT.SALES = ((SUM(SALES) - SUM(RETURNS)) * (52 / NUM.PERIODS))
0024: END ELSE
0025: TURNS = 0
0026: RETURN
0027: END
0028: IF AVG.INV # 0 AND NUM.PERIODS # 0 THEN
0029: TURNS = OCONV(ICONV(100*(TOT.SALES/AVG.INV),'MD0'),'MD2')
0030: END ELSE
0031: TURNS = 0
0032: END
0033:
0034: RETURN

Anyone have any ideas?



Charles Stevenson wrote:
DAVID WADEMAN wrote:  Is there the ID of GM.SHF in GM.GMF file? If 
so then you could used:
  ED DICT GM.GMF TURNS  0001: I  0002: 
SUBR('*CALC.TURNS',GMF.SHF.ID)



Jeff's originally attempted

TRANS(GM.SHF,SMF.LINK,TURNS,'X')

implies that DICT GM.GMF SMF.LINK is the foreign key to the 
corresponding GM.SHF record.

That's why I said that the proper I descriptor will be

DICT GM.GMF TURNS
01: I
02: CALL( '*CALC.TURNS', SMF.LINK )

That assumes that CALC.TURNS doesn't do something like assume @RECORD 
contains the current GM.SHF record.


If it does, it will need to be altered to pass the record as an 
argument, instead/

Then you'd use it in 2 I-descriptors as:

DICT GM.SHF TURNS
01: I
02: SUBR( '*CALC.TURNS', @ID, @RECORD )

DICT GM.GMF TURNS
01: I
02: SUBR( '*CALC.TURNS', SMF.LINK, RAISE(TRANS( GM.SHF, SMF.LINK, 
-1,'X')))


The -1 trans arg means return the whole record.
The RAISE() is because TRANS() automatically lowers all delimiters a 
notch. (Why that is, is for another thread.)



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





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


Re: [U2] Trans() to a subroutine I descriptor

2009-07-14 Thread Jeff Schasny
I'm an idiot... I just changed changed the program to have unique errors 
for each scenario (E1, E2, etc) and it was still returning all zeros. 
Then I realized I had forgotten the * in front of the routine name in 
the SUBR() function:

This works like a champ.. Thanks all
0002: SUBR(*CALC.TURNS,SMF.LINK)
:


Steve Romanow wrote:
Since your using TURNS=0 for all error conditions, you cannot tell 
which exit your taking. Why not make each failure a different negative 
number, so you can see. Maybe it failing the open, maybe the next. 
Return -1, -2, -3, etc.


Jeff Schasny wrote:
The CALC.TURNS routine does not use @record. However, when I create 
the following subroutine call I type in DICT GM.GMF it returns all 
zeros.


ED DICT GM.GMF TURNS
This is a Type I Descriptor last compiled on 07/14/09 at 14:21.
20 lines long.

: P7
0001: I
0002: SUBR(CALC.TURNS,SMF.LINK)
0003:
0004: TURNS
0005: 7R
0006: S
0007:

So I thought well, maybe SMF.LINK is not creating the correct keys 
for the GM.SHF so I tried:


LIST GM.GMF SMF.LINK
LIST GM.GMF SMF.LINK 02:24:22pm 14 Jul 2009 PAGE 1
GM.GMF SMF LINK...

5614862 5614862.1
5269563 5269563.1
6110292 6110292.1
5164474 5164474.1
5599851 5599851.1
5840059 5840059.1
5990189 5990189.1
4894240 4894240.1
6095281 6095281.1

OK, those are the right keys. Heres the program code:

0006: OPEN 'GM.SHF' TO GM.SHF.FILE ELSE
0007: TURNS = 0
0008: RETURN
0009: END
0010: READ REC FROM GM.SHF.FILE,GM.SHF.ID ELSE
0011: TURNS = 0
0012: RETURN
0013: END
0014:
0015: BEGIN.ON.HAND = REC61
0016: SALES = REC63
0017: END.ON.HAND = REC64
0018: RETURNS = REC67
0019: NUM.PERIODS = DCOUNT(REC63,@VM)
0020:
0021: AVG.INV = (BEGIN.ON.HAND1,1 + SUM(END.ON.HAND)) / (NUM.PERIODS +
1)
0022: IF NUM.PERIODS # 0 THEN
0023: TOT.SALES = ((SUM(SALES) - SUM(RETURNS)) * (52 / NUM.PERIODS))
0024: END ELSE
0025: TURNS = 0
0026: RETURN
0027: END
0028: IF AVG.INV # 0 AND NUM.PERIODS # 0 THEN
0029: TURNS = OCONV(ICONV(100*(TOT.SALES/AVG.INV),'MD0'),'MD2')
0030: END ELSE
0031: TURNS = 0
0032: END
0033:
0034: RETURN

Anyone have any ideas?



Charles Stevenson wrote:
DAVID WADEMAN wrote:  Is there the ID of GM.SHF in GM.GMF file? If 
so then you could used:
  ED DICT GM.GMF TURNS  0001: I  0002: 
SUBR('*CALC.TURNS',GMF.SHF.ID)



Jeff's originally attempted

TRANS(GM.SHF,SMF.LINK,TURNS,'X')

implies that DICT GM.GMF SMF.LINK is the foreign key to the 
corresponding GM.SHF record.

That's why I said that the proper I descriptor will be

DICT GM.GMF TURNS
01: I
02: CALL( '*CALC.TURNS', SMF.LINK )

That assumes that CALC.TURNS doesn't do something like assume 
@RECORD contains the current GM.SHF record.


If it does, it will need to be altered to pass the record as an 
argument, instead/

Then you'd use it in 2 I-descriptors as:

DICT GM.SHF TURNS
01: I
02: SUBR( '*CALC.TURNS', @ID, @RECORD )

DICT GM.GMF TURNS
01: I
02: SUBR( '*CALC.TURNS', SMF.LINK, RAISE(TRANS( GM.SHF, SMF.LINK, 
-1,'X')))


The -1 trans arg means return the whole record.
The RAISE() is because TRANS() automatically lowers all delimiters a 
notch. (Why that is, is for another thread.)



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





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



--

Jeff Schasny - Denver, Co, USA
jschasny at gmail dot com

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


Re: [U2] Trans() to a subroutine I descriptor

2009-07-14 Thread Charles Stevenson
1. In the listing you show SMF.LINK is always blank.  Empty string, I 
presume.

SMF.LINK is the key to GM.SHF record, right?
You don't show the TURNS column .
But if you did it would always be passing an empty string as the GM.SHF 
id to evalueate, no?
So maybe the problem is not your subroutine or I-descriptor, but  the 
SMF.LINK field.


2.  I assume the 1st line of the subroutine is:
 SUBROUTINE CALC.TURNS(  TURNS, GM.SHF.ID )
right?

3. Is this UV or UD?  If UV look at DLIST command to help debuge 
I-descriptors.


4.  This is an efficiency, not functionality point:  Don'tyopen a file 
on every call of the subroutine.

But we can discuss efficiency after you get the functionality right.


cds


Jeff Schasny wrote:
The CALC.TURNS routine does not use @record. However, when I create 
the following subroutine call I type in DICT GM.GMF it returns all zeros.


ED DICT GM.GMF TURNS
This is a Type I Descriptor last compiled on 07/14/09 at 14:21.
20 lines long.

: P7
0001: I
0002: SUBR(CALC.TURNS,SMF.LINK)
0003:
0004: TURNS
0005: 7R
0006: S
0007:

So I thought well, maybe SMF.LINK is not creating the correct keys for 
the GM.SHF so I tried:


LIST GM.GMF SMF.LINK
LIST GM.GMF SMF.LINK 02:24:22pm 14 Jul 2009 PAGE 1
GM.GMF SMF LINK...

5614862 5614862.1
5269563 5269563.1
6110292 6110292.1
5164474 5164474.1
5599851 5599851.1
5840059 5840059.1
5990189 5990189.1
4894240 4894240.1
6095281 6095281.1

OK, those are the right keys. Heres the program code:

0006: OPEN 'GM.SHF' TO GM.SHF.FILE ELSE
0007: TURNS = 0
0008: RETURN
0009: END
0010: READ REC FROM GM.SHF.FILE,GM.SHF.ID ELSE
0011: TURNS = 0
0012: RETURN
0013: END
0014:
0015: BEGIN.ON.HAND = REC61
0016: SALES = REC63
0017: END.ON.HAND = REC64
0018: RETURNS = REC67
0019: NUM.PERIODS = DCOUNT(REC63,@VM)
0020:
0021: AVG.INV = (BEGIN.ON.HAND1,1 + SUM(END.ON.HAND)) / (NUM.PERIODS +
1)
0022: IF NUM.PERIODS # 0 THEN
0023: TOT.SALES = ((SUM(SALES) - SUM(RETURNS)) * (52 / NUM.PERIODS))
0024: END ELSE
0025: TURNS = 0
0026: RETURN
0027: END
0028: IF AVG.INV # 0 AND NUM.PERIODS # 0 THEN
0029: TURNS = OCONV(ICONV(100*(TOT.SALES/AVG.INV),'MD0'),'MD2')
0030: END ELSE
0031: TURNS = 0
0032: END
0033:
0034: RETURN

Anyone have any ideas?



Charles Stevenson wrote:
DAVID WADEMAN wrote:  Is there the ID of GM.SHF in GM.GMF file? If 
so then you could used:
  ED DICT GM.GMF TURNS  0001: I  0002: 
SUBR('*CALC.TURNS',GMF.SHF.ID)



Jeff's originally attempted

TRANS(GM.SHF,SMF.LINK,TURNS,'X')

implies that DICT GM.GMF SMF.LINK is the foreign key to the 
corresponding GM.SHF record.

That's why I said that the proper I descriptor will be

DICT GM.GMF TURNS
01: I
02: CALL( '*CALC.TURNS', SMF.LINK )

That assumes that CALC.TURNS doesn't do something like assume @RECORD 
contains the current GM.SHF record.


If it does, it will need to be altered to pass the record as an 
argument, instead/

Then you'd use it in 2 I-descriptors as:

DICT GM.SHF TURNS
01: I
02: SUBR( '*CALC.TURNS', @ID, @RECORD )

DICT GM.GMF TURNS
01: I
02: SUBR( '*CALC.TURNS', SMF.LINK, RAISE(TRANS( GM.SHF, SMF.LINK, 
-1,'X')))


The -1 trans arg means return the whole record.
The RAISE() is because TRANS() automatically lowers all delimiters a 
notch. (Why that is, is for another thread.)



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





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


Re: [U2] u2blog.org?

2009-07-14 Thread Dawn Wolthuis
Yeah, but that's pervasive technology rhetoric. Tell someone that DB2 is
better than their database, or that Vista is better than their OS, or that
yahoomail is better than their mail, or that COBOL or Java is better than
their language and you will get the same thing. The planet still seems big
enough for all of the above and then some, so I think this planet can
accommodate us too. smiles.  --dawn
P.S. My blog is still http://snupnow.wordpress.com in case you are
interested and have not yet subscribed by e-mail or rss
-- 
Dawn M. Wolthuis

Take and give some delight today

On Wed, Jun 10, 2009 at 12:16 PM, George Gallen ggal...@wyanokegroup.comwrote:

  I don't know…I think it might be a planet.



 How many times have you tried to tell someone how much better U2 is than
 their database,

   only to get the response What PLANET are you on?



 George



 *From:* u2-users-boun...@listserver.u2ug.org [mailto:
 u2-users-boun...@listserver.u2ug.org] *On Behalf Of *Tony G
 *Sent:* Wednesday, June 10, 2009 1:00 PM
 *To:* u2-users@listserver.u2ug.org
 *Subject:* Re: [U2] u2blog.org?



 Since there are a limited number of blogs in this community we're more like
 a room than a planet, so I recommend people simply check here to see what
 blogs are available:

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



 Thanks to all who responded - please update PickWiki.com if you are aware
 of another U2-oriented blog, or feel free to email me and I'll make the
 update.



 Tony Gravagno

 Nebula Research and Development

 TG@ remove.pleaseNebula-RnD.com

 remove.pleaseNebula-RnD.com/blog

 Visit PickWiki.com!  Contribute!


  --


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


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