Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Parsing a string in WebFocus...

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Parsing a string in WebFocus...
 Login/Join
 
Platinum Member
posted
Is there any way in WebFocus, where we can parse the below string taking ~ as the separator.
Note : The number of ~ is fixed.

To Be passed String:
************************************************
IBIC_user=camwbf~FRAMES=|200704*~SPC=~_VVPC=~BAREA_CD_C2=|EUR*~VVPC=~VVPC_DDN=~_AREA=EUR~VVPCFRAME_CHANGED=~SERVICE=~DIR_CD_C2=~IBIF_ex=ccam_allocmangmnt_new~_SERVICE=~AREA=
************************************************

Format In Which I need to convert it in webfcos:
************************************************
IBIC_user=camwbf
FRAMES=|200704*
SPC=
_VVPC=
BAREA_CD_C2=|EUR*
VVPC=
VVPC_DDN=
_AREA=EUR
VVPCFRAME_CHANGED=
SERVICE=
DIR_CD_C2=
IBIF_ex=ccam_allocmangmnt_new
_SERVICE=
AREA=
************************************************


WF Server: 7.1.4 on Z/OS and Linux, ReportCaster
Data: DB2, DB2/UDB, Adabas, SQL Server, Oracle Output: HTML,PDF,Excel2K
WF Client: Servlet, CGI
 
Posts: 133 | Registered: May 12, 2007Report This Post
Member
posted Hide Post
Check if this works for you
******************************************


-SET &STR='IBIC_user=camwbf~FRAMES=|200704*~SPC=~_VVPC=~BAREA_CD_C2=|EUR*~VVPC=~VVPC_DDN=~_AREA=EUR~VVPCFRAME_CHANGED=~SERVICE=~DIR_CD_C2=~IBIF_ex=ccam_allocmangmnt_new~_SERVICE=~AREA= ';

-SET &F1 = GETTOK(&STR,&STR.LENGTH,1,'~',20,'A20');
-SET &F2 = GETTOK(&STR,&STR.LENGTH,2,'~',20,'A20');
-SET &F3 = GETTOK(&STR,&STR.LENGTH,3,'~',20,'A20');
-SET &F4 = GETTOK(&STR,&STR.LENGTH,4,'~',20,'A20');
-SET &F5 = GETTOK(&STR,&STR.LENGTH,5,'~',20,'A20');

-SET &F6 = GETTOK(&STR,&STR.LENGTH,6,'~',20,'A20');
-SET &F7 = GETTOK(&STR,&STR.LENGTH,7,'~',20,'A20');
-SET &F8 = GETTOK(&STR,&STR.LENGTH,8,'~',20,'A20');
-SET &F9 = GETTOK(&STR,&STR.LENGTH,9,'~',20,'A20');
-SET &F10 = GETTOK(&STR,&STR.LENGTH,10,'~',20,'A20');
-SET &F11 = GETTOK(&STR,&STR.LENGTH,11,'~',20,'A20');
-SET &F12 = GETTOK(&STR,&STR.LENGTH,12,'~',40,'A40');
-SET &F13 = GETTOK(&STR,&STR.LENGTH,13,'~',20,'A20');
-SET &F14 = GETTOK(&STR,&STR.LENGTH,14,'~',20,'A20');


-TYPE F1: &F1
-TYPE F2: &F2
-TYPE F3: &F3
-TYPE F4: &F4
-TYPE F5: &F5
-TYPE F6: &F6
-TYPE F7: &F7
-TYPE F8: &F8
-TYPE F9: &F9
-TYPE F10: &F10
-TYPE F11: &F11
-TYPE F12: &F12
-TYPE F13: &F13
-TYPE F14: &F14


*********************************
GETTOK is used for Extracting a Substring (Token)

Syntax of GETTOK is

GETTOK(infield, inlen, token_number, 'delim', outlen, outfield)


Thanks

Lakshmi


Lakshmi
WF 713 WinXP/IIS/Apache Self Service
 
Posts: 27 | Registered: February 17, 2007Report This Post
Virtuoso
posted Hide Post
You don't say if you want the output as seperate &vars or not.

If so then Lakshmi's approach, maybe in a loop, would be correct. If you just want to display it in that format somewhere (!), then you could use:
-SET &STRING='IBIC_user=camwbf~FRAMES=|200704*~SPC=~_VVPC=~BAREA_CD_C2=|EUR*~VVPC=~VVPC_DDN=~_AREA=EUR~VVPCFRAME_CHANGED=~SERVICE=~DIR_CD_C2=~IBIF_ex=ccam_allocmangmnt_new~_SERVICE=~AREA=';
-SET &NEWSTRING=STRREP (&STRING.LENGTH,&STRING,1,'~',1,HEXBYT(13,'A1'),&STRING.LENGTH,'A&STRING.LENGTH');
-TYPE &NEWSTRING


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Master
posted Hide Post
focuzsambit,

I created a user written subroutine that would take a string separated by an '&' with the name=value pairs (much like a URL query string) and would return the value for the requested name. It is a dll so it would only work in windows. I would imagine that you could do the same with the '~' if you wanted to extend WebFOCUS. Just an Idea.




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
I would recommend using a combination of POSIT and SUBSTR functions (see the USING FUNCTIONS manual), especially since there are a fixed number of ~ characters. say that fixed number is 10.
Then you'll be creating 11 resultant &VARS,
and can -WRITE them each out to a file in the format you want.

If the inbound character string is in a file, then you could write a new MFD for that file using FORMAT DFIX and DELIMITER='~'
and read the 11 variables you define in that MFD and print them out using the OVER command, PRINT var1 OVER var2..etc... if all you want is a report, not an actual output file.

If you need help with the POSIT/SUBSTR, post back and we'll help you. Focus text editing capabilities are sine qua non!
-S




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Master
posted Hide Post
focuzsambit,

If you are running on windows I would be glad to send you my C Source Code and the DLL I created along with a sample focexec on how to call it. I did not make any changes to it to work with the ~ I just used CTRAN to convert the ~ to an & and then called to user written subroutine. Works great and can be called from dialog manager to create seperate & variables or from a DEFINE or COMPUTE. Below is the output from the sample focexec
 -SET &MYSTRING = 'camwbf~FRAMES=|200704*~SPC=~_VVPC=~BAREA_CD_C2=|EUR*~VVPC=~VVPC_DDN=~_AREA=EUR~VVPCFRAME_CHANGED=~SERVICE=~DIR_CD_C2=~IBIF_ex=ccam_allocmangmnt_new~_SERVICE=~AREA=';
 -SET &MYSTRING = CTRAN(&MYSTRING.LENGTH, &MYSTRING, 126, 38, 'A163');
 -SET &BAREA_CD_C2 = PARMVAL(&MYSTRING.LENGTH, &MYSTRING, 11, 'BAREA_CD_C2', 'A80');
 -SET &_AREA = PARMVAL(&MYSTRING.LENGTH, &MYSTRING, 5, '_AREA', 'A80');
 -SET &IBIF_ex = PARMVAL(&MYSTRING.LENGTH, &MYSTRING, 7, 'IBIF_ex', 'A80');
 -SET &FRAMES = PARMVAL(&MYSTRING.LENGTH, &MYSTRING, 6, 'FRAMES', 'A80');
 -TYPE FRAMES = &FRAMES
 FRAMES = |200704*
 -TYPE BAREA_CD_C2 = &BAREA_CD_C2
 BAREA_CD_C2 = |EUR*
 -TYPE _AREA = &_AREA
 _AREA = EUR
 -TYPE IBIF_ex = &IBIF_ex
 IBIF_ex = ccam_allocmangmnt_new


Just send me a private message if you what it.

This message has been edited. Last edited by: TexasStingray,




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Parsing a string in WebFocus...

Copyright © 1996-2020 Information Builders