For Programmers: Free Programming Magazines  


Home > Archive > Clarion > September 2006 > How to get a groups reference from a variable?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to get a groups reference from a variable?
Steffen

2006-09-27, 7:55 am

I have defined numerous file structures using the Group structure. Each
group is used to share the same memory location as an ASCII file which
I am importing using the OVER attribute.

Each line in the ASCII file defines which group I have to use so I have
the name of the group. I am using a class called anyAscii (from
ClarionMag) which requires a reference to the specific group as defined
in the class:

SetRecordLayout PROCEDURE(*GROUP RecordGroup, <STRING
FieldSeperator>, <STRING FieldEnclosure> ), BYTE, PROC, VIRTUAL

And to use it I assign the value: InputFile.SetRecordLayout(BS0602002)

I have defined allot of file structures and I would really like to use
a variable:

LOC:RecordLayout =
PBS:SystemIdentification&PBS:DeliveryType&PBS:SectionNo&AsciiLine[14 :
17]&AsciiLine[3 : 5]

And use this variable: InputFile.SetRecordLayout(LOC:RecordLayout)

Instead of having a CASE statement with all the different kinds of
groupts:

CASE LOC:RecordLayout
OF 'BS0602002'
InputFile.SetRecordLayout(BS0602002)
Betalingsservice :=: BS0602002
OF 'BS06020211012'
InputFile.SetRecordLayout(BS06020211012)
Betalingsservice :=: BS06020211012
OF 'BS060202110236042'
InputFile.SetRecordLayout(BS060202110236042)
Betalingsservice :=: BS060202110236042
OF 'BS060202110237042'
InputFile.SetRecordLayout(BS060202110237042)
Betalingsservice :=: BS060202110237042
...

Any suggestions?


Steffen

JonWat

2006-09-27, 7:55 am

Youcould make a QUEUE with the
Steffen wrote:
> I have defined numerous file structures using the Group structure. Each
> group is used to share the same memory location as an ASCII file which
> I am importing using the OVER attribute.
>
> Each line in the ASCII file defines which group I have to use so I have
> the name of the group. I am using a class called anyAscii (from
> ClarionMag) which requires a reference to the specific group as defined
> in the class:
>
> SetRecordLayout PROCEDURE(*GROUP RecordGroup, <STRING
> FieldSeperator>, <STRING FieldEnclosure> ), BYTE, PROC, VIRTUAL
>
> And to use it I assign the value: InputFile.SetRecordLayout(BS0602002)
>
> I have defined allot of file structures and I would really like to use
> a variable:
>
> LOC:RecordLayout =
> PBS:SystemIdentification&PBS:DeliveryType&PBS:SectionNo&AsciiLine[14 :
> 17]&AsciiLine[3 : 5]
>
> And use this variable: InputFile.SetRecordLayout(LOC:RecordLayout)
>
> Instead of having a CASE statement with all the different kinds of
> groupts:
>
> CASE LOC:RecordLayout
> OF 'BS0602002'
> InputFile.SetRecordLayout(BS0602002)
> Betalingsservice :=: BS0602002
> OF 'BS06020211012'
> InputFile.SetRecordLayout(BS06020211012)
> Betalingsservice :=: BS06020211012
> OF 'BS060202110236042'
> InputFile.SetRecordLayout(BS060202110236042)
> Betalingsservice :=: BS060202110236042
> OF 'BS060202110237042'
> InputFile.SetRecordLayout(BS060202110237042)
> Betalingsservice :=: BS060202110237042
> ...
>
> Any suggestions?
>
>
> Steffen


Put the group names into a queue with the address (reference), sort by
the name,

then:

GET(layoutnames,LOC:recordLayout)
Betalingsservice &= layoutnames.grpref

Jon

Steffen

2006-09-27, 7:55 am

Thanks Jon,

That could work but would still require allot of typing (there is more
then 1000 groups) for assigning the groups to the queue.

Steffen

JonWat skrev:

> Youcould make a QUEUE with the
> Steffen wrote:
>
> Put the group names into a queue with the address (reference), sort by
> the name,
>
> then:
>
> GET(layoutnames,LOC:recordLayout)
> Betalingsservice &= layoutnames.grpref
>
> Jon


JonWat

2006-09-27, 6:55 pm

Yes, typing would be bad.

How about :

you put all of your group structures into an include file (which you
include). You write a very simple ascii reader (just takes the word
before "GROUP") to create a source file for you, each set of lines
looks like:

LQ:LayoutName=QUOTE(<groupname> )
LQ:LayoutAddress = Address(<groupname> )
Add(LayoutQueue,LQ:LayoutName)

Jon
Steffen wrote:[color=darkred]
> Thanks Jon,
>
> That could work but would still require allot of typing (there is more
> then 1000 groups) for assigning the groups to the queue.
>
> Steffen
>
> JonWat skrev:
>

Steffen

2006-09-28, 3:55 am

Thanks Jon,

Just had to think it through in order to understand what you ment. This
is a good approach I can use.

Steffen

JonWat skrev:

> Yes, typing would be bad.
>
> How about :
>
> you put all of your group structures into an include file (which you
> include). You write a very simple ascii reader (just takes the word
> before "GROUP") to create a source file for you, each set of lines
> looks like:
>
> LQ:LayoutName=QUOTE(<groupname> )
> LQ:LayoutAddress = Address(<groupname> )
> Add(LayoutQueue,LQ:LayoutName)
>
> Jon


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com