Thanks Thomas,
Very close. Unfortunately the the data is not consistent. That is why I was trying to use the MATCHFILED function of 0N0X. It's basically a string of numbers, a single alpha, and more numbers including a decimal point in the second set of numbers, sometimes . I need to display the alpha and numbers after the alpha including any decimal points. It would be nice to modify your suggestion to replace the C4 with a way to index the location of the alpha in the field. I tried a few things to no avail.
Tek.
------------------------------
Tek Ileri
Rocket Forum Shared Account
------------------------------
Okay, this makes it a bit more complicated.
Unfortunately for this expression SB/XA doesn't create an OE-Correlative which is usab le withoult SB/XA installed, but I explain how it worked anyway - maybe you get an idea how it could work. (I'm not good in writing UV-Correlatives my own)
I could manage it by createing an additional helper field.
Lets assume we have a file "FLAGFILE" WITH 2 Items
Item A -> Attribute 1 = 1234A665
Item B -> Attribute 1 = 123G56
The Helper Field got the SB# Expression: (REPL(OCONV(<1>,"MCA"),"_",<1>))
Which basically replaces the non-numeric part of the whole string with an Underscore. (assuming there is only one Character)
I called The helper Field "FELD4"
The Results are Item A: 1234_665 ; ItemB: 123_56
The coresponding OE-Correlativ unfortunately looks a bit weird - so you can not use it without SB/XA installed.
As a Second Step I created the Field for splitting the string and get the first part.
The SB/XA Expression looks like this: (OCONV(FELD4,"G0_1"))
Which basically returns all characters before the first "_" in the helper field.
Unfortunately Im not good in writing OE-Correlatives but maybe you get an idea how to manange the two steps on your own with UV-Correlative's
- Replace any character with a fixed string (e.g. "_")
- Do a Group-Extraction on the fixed string
greetings
Thomas
------------------------------
Thomas Ludwig
System Builder Developer
Rocket Forum Shared Account
------------------------------
I need to create a dictionary that takes the multivalue data from a field in FILE, field<1>
Say:
Field<1> is 123a1]456b2]789c9
I want a dictionary item, say called TEST2 to show only (a1,b2,c9)
Currently i have the Dictionary item TEST2 as I-type with MATCHFIELD(@RECORD<1>,"0N0X",2) in field 2
I want LIST FILE F1 TEST2 to show:
FILE F1……… TEST2………
1 123a1 a1
2 456b2 b2
3 789c9 c9
But what I'm getting is:
LIST FILE F1 TEST2
FILE F1……… TEST2………
1 123S1 S1
2 456S2 456S2
3 789L9 789L9
I've tried a number of options in the TEST2 dictionary item but no joy. Can anyone help with this. I had done something similar decades ago, but cannot remember how. I want to avoid using a subroutine if I can. Any advice would be greatly appreciated.
Tek.
------------------------------
Tek Ileri
Rocket Forum Shared Account
------------------------------
You could also try something like this in your I-Type
IFS(EQS(FIELDS(WHOLE,'A',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'B',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'C',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'D',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'E',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'F',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'G',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'H',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'I',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'J',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'K',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'L',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'M',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'N',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'O',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'P',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'Q',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'R',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'S',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'T',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'U',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'V',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'W',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'X',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'Y',2,1),REUSE('')),IFS(EQS(FIELDS(WHOLE,'Z',2,1),REUSE('')),WHOLE,CATS(REUSE('Z'),FIELDS(WHOLE,'Z',2,1))),CATS(REUSE('Y'),FIELDS(WHOLE,'Y',2,1))),CATS(REUSE('X'),FIELDS(WHOLE,'X',2,1))),CATS(REUSE('W'),FIELDS(WHOLE,'W',2,1))),CATS(REUSE('V'),FIELDS(WHOLE,'V',2,1))),CATS(REUSE('U'),FIELDS(WHOLE,'U',2,1))),CATS(REUSE('T'),FIELDS(WHOLE,'T',2,1))),CATS(REUSE('S'),FIELDS(WHOLE,'S',2,1))),CATS(REUSE('R'),FIELDS(WHOLE,'R',2,1))),CATS(REUSE('Q'),FIELDS(WHOLE,'Q',2,1))),CATS(REUSE('P'),FIELDS(WHOLE,'P',2,1))),CATS(REUSE('O'),FIELDS(WHOLE,'O',2,1))),CATS(REUSE('N'),FIELDS(WHOLE,'N',2,1))),CATS(REUSE('M'),FIELDS(WHOLE,'M',2,1))),CATS(REUSE('L'),FIELDS(WHOLE,'L',2,1))),CATS(REUSE('K'),FIELDS(WHOLE,'K',2,1))),CATS(REUSE('J'),FIELDS(WHOLE,'J',2,1))),CATS(REUSE('I'),FIELDS(WHOLE,'I',2,1))),CATS(REUSE('H'),FIELDS(WHOLE,'H',2,1))),CATS(REUSE('G'),FIELDS(WHOLE,'G',2,1))),CATS(REUSE('F'),FIELDS(WHOLE,'F',2,1))),CATS(REUSE('E'),FIELDS(WHOLE,'E',2,1))),CATS(REUSE('D'),FIELDS(WHOLE,'D',2,1))),CATS(REUSE('C'),FIELDS(WHOLE,'C',2,1))),CATS(REUSE('B'),FIELDS(WHOLE,'B',2,1))),CATS(REUSE('A'),FIELDS(WHOLE,'A',2,1)))
I know it's ugly, but it should work. It's even uglier if you allow upper-case AND lower-case. The above only assumes upper-case.
WHOLE is a D-Type
00 WHOLE
01 D
02 1
03
04
05 20L
06 M
------------------------------
Tyrel Marak
Technical Support Manager
Aptron Corporation
Florham Park NJ US
------------------------------
I need to create a dictionary that takes the multivalue data from a field in FILE, field<1>
Say:
Field<1> is 123a1]456b2]789c9
I want a dictionary item, say called TEST2 to show only (a1,b2,c9)
Currently i have the Dictionary item TEST2 as I-type with MATCHFIELD(@RECORD<1>,"0N0X",2) in field 2
I want LIST FILE F1 TEST2 to show:
FILE F1……… TEST2………
1 123a1 a1
2 456b2 b2
3 789c9 c9
But what I'm getting is:
LIST FILE F1 TEST2
FILE F1……… TEST2………
1 123S1 S1
2 456S2 456S2
3 789L9 789L9
I've tried a number of options in the TEST2 dictionary item but no joy. Can anyone help with this. I had done something similar decades ago, but cannot remember how. I want to avoid using a subroutine if I can. Any advice would be greatly appreciated.
Tek.
------------------------------
Tek Ileri
Rocket Forum Shared Account
------------------------------
As I noted yesterday, the best way to do this is via a subroutine, and the SUBR function. Here is the subroutine:
SUBROUTINE XXTRACT(ans, indata, pattern, elno)
*****************************************************************************
ans = ''
dcv = DCOUNT(indata<1>, @VM)
FOR vno = 1 TO dcv
adata = indata<1, vno>
aval = MATCHFIELD(adata, pattern, elno)
ans<1, vno> = aval
NEXT vno
RETURN
END
And to use this, create a dictionary like this:
I
SUBR('XXTRACT', F1, '0N0X', 2)
XTract
7L
M
This should do exactly what you want.
HTH
Brian
------------------------------
Brian Speirs
Senior Analyst - Information Systems
Rush Flat Ltd
Wellington NZ
------------------------------
I need to create a dictionary that takes the multivalue data from a field in FILE, field<1>
Say:
Field<1> is 123a1]456b2]789c9
I want a dictionary item, say called TEST2 to show only (a1,b2,c9)
Currently i have the Dictionary item TEST2 as I-type with MATCHFIELD(@RECORD<1>,"0N0X",2) in field 2
I want LIST FILE F1 TEST2 to show:
FILE F1……… TEST2………
1 123a1 a1
2 456b2 b2
3 789c9 c9
But what I'm getting is:
LIST FILE F1 TEST2
FILE F1……… TEST2………
1 123S1 S1
2 456S2 456S2
3 789L9 789L9
I've tried a number of options in the TEST2 dictionary item but no joy. Can anyone help with this. I had done something similar decades ago, but cannot remember how. I want to avoid using a subroutine if I can. Any advice would be greatly appreciated.
Tek.
------------------------------
Tek Ileri
Rocket Forum Shared Account
------------------------------
There are a number of suggestions below, but here's my option. In the UV home directory create the following entry in APP.PROGS:
1111
0001 SUBROUTINE U1111(ANS,STATUS,DATA,TYPE)
0002 $OPTIONS DEFAULT
0003 vmcnt = dcount(DATA<1>,@VM)
0004 ANS = ''
0005 for i = 1 to vmcnt
0006 ANS<i> = DATA<1,i>[index(DATA<1,i>,oconv(DATA<1,i>,'MCA')[1,1],1),len(DATA<1,i>)]
0007 next i
0008 STATUS = 0
0009 RETURN
0010 END
Compile and globally catalog this as follows:
BASIC APP.PROGS 1111
CATALOG APP.PROGS $1111 1111
Finally, create the following dictionary for your file:
A1
0001 I
0002 OCONVS(@RECORD<1>,'U1111')
0003
0004
0005 10L
0006 M
Now, when you use this dictionary you get the result you want (if I understand what you're after):
LIST TESTFILE F1 A1 08:06:47am 13 Dec 2023 PAGE 1
TESTFILE...................... F1............. A1........
0001 0A10 A10
04B9.80 B9.80
123Z56568 Z56568
------------------------------
Martin Shields
Senior Technical Consultant
Meier Business Systems PTY LTD
Carnegie VIC AU
------------------------------