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= ************************************************
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
May 30, 2007, 10:54 AM
susannah
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
May 30, 2007, 05:23 PM
TexasStingray
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