Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Amper variables between procedures

Status
Not open for further replies.

rummage

MIS
Apr 8, 2003
33
0
0
US
Hi ,

The following is my code of the first FEX procedure


-SET &TODAY=&YMD;
-SET &AJB = GETUSER(A8);
-TYPE USER &AJB

-TYPE &DATE
-SET &SESSIONID = &AJB || &TODAY || 'AAAAAAAAAAAAAAAAAAAAAAA'

SQL SQLMSS

EX GOA01_SQL.dbo.spgoa_WF_Report_Fill_temp_0421 ,
'&SESSIONID',
'&D1','&D2' ,0, 1, '&TEXTAREA1';

END

-HTMLFORM WF042501


This is what I am doing in the first FEX. I am creating a Session ID and executing a SQL stored procedure using the session ID as one of the parameters. Then I am calling a HTML form named WF042501.

I have a push button called 'Close' in the above HTML form. When I click on the push button, it executes a FEX procedure.

The coding of that procedure is the following


-SET &TODAY=&YMD;
-SET &AJB = GETUSER(A8);
-TYPE USER &AJB

-TYPE &DATE

SET SQLENGINE = SQLMSS

SQL SET AUTODISCONNECT ON FIN;
SQL SET AUTOCOMMIT ON FIN;


SQL SET PASSRECS ON

SQL


EX GOA01_SQL.DBO.spgoa_DropUserTables, '&SESSIONID';

COMMIT WORK;
END

SQL COMMIT WORK;

Here what I am doing is that I try to use the Session ID created in the first FEX procedure to execute another SQL stored procedure. Now, my problem is that I am not able to use that session ID in this FEX procedure. How do I get that Session ID into this procedure.

Thanks
Thambaiya












 
Hi Thambaiya,

I suppose the button on your HTML site is embedded in form tags <form> ... </form>. Then write into this fiorm block the following:
[tt]
<input type=&quot;hidden&quot; name=&quot;SESSIONID&quot; value=&quot;&SESSIONID&quot;>
[/tt]

Then in the 2nd FEX which you call from this form write this at the beginning:
[tt]
-SET &SESSIONID = &&SESSIONID;
[/tt]

After that you have the variable &SESSIONID for further use in the 2nd FEX.

Eva
 
Have you tried using &&variables which hold their values for the entire Focus session and not just for the duration of the originating fex, as &variables do? Alternatively, you could possibly store the sessionid value in a text file using dialogue manager '-write' and retrieve it with '-read'. You would need to issue a filedef for the text file,
e.g. (USE UPPERCASE FOR ALL BELOW)
filedef txtfile disk c:\txtfile.txt
-run
-set &sessionid = 'whatever';
-write txtfile &sessionid
-run
.....later on.....
-read txtfile &session.8 (8=length of &sessionid field)
-type session
-run
..... cleanup operations.....
filedef txtfile clear
erase c:\txtfile.txt
 
Thanks Eva and PeterG5 for the responses. I used the file method of getting the sessionID. It worked.

I have this question:

I am trying to create a unique ID for the session. For that I am concatenating UserID + Date + Time.
For time, I use HHMMSS(A8).

My code is like the following:

-SET &AJB = GETUSER(A8) || &YMD || HHMMSS(A8);

The problem is that HHMMSS results in a value that contains the character '.'

I would like to remove the '.' from the value. How can I do that. Can I use any string manipulation function for this?

Thanks
Thambaiya

 
You can use a mask to choose only the parts of the data which you actually want to see, e.g. if the string contains 11.09.56 (time now)and you only want to see the digits, use a defined field to pick out the required characters, e.g.
newfield/a6 = edit(oldfield,'99$99$99');
so oldfield contains 11.09.56 and newfield contains 110956
(in the edit mask, 9 means show the digit; $ means ignore it).
 
Thanks PeterG5. I have done the code using the EDIT. It works.

Thambaiya
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top