|
Go
![]() |
New
![]() |
Search
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Platinum Member |
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 |
||
|
|
Member |
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 |
|||
|
|
Master |
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.6.5, PMF 5.1, MRE,RA,RG, etc... Win2003(8xQuad)/IIS/Tomcat with SSL and AD security. |
|||
|
|
Master |
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. |
||||
|
|
Expert |
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
|
|||||
|
|
Master |
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, |
||||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

