×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Entering and Deleting values

Entering and Deleting values

Entering and Deleting values

(OP)
I've got this code to scrub data in Excel and input it into the mainframe accordingly. I'm wondering if there's a way to use the same code&Excel worksheet to conversely delete these values - short of filling in the Excel worksheet with a horde of spacebars, is there something else I can use what will both enter and delete values? Perhaps I am limiting myself by using PutString; is there another command I can try? Thanks!


InputHeader:

Sess0.Screen.sendkeys("<pf5>")
Sess0.Screen.WaitHostQuiet(1)
Sess0.Screen.PutString vblSheet.Cells(RowX, 2),3,12
Sess0.Screen.PutString vblSheet.Cells(RowX, 1),4,11
Sess0.Screen.sendkeys("<enter>")
Sess0.Screen.WaitHostQuiet(5)
Sess0.Screen.PutString vblSheet.Cells(RowX, 3),6,17
Sess0.Screen.PutString vblSheet.Cells(RowX, 4),6,41
Sess0.Screen.PutString vblSheet.Cells(RowX, 5),6,65
Sess0.Screen.PutString vblSheet.Cells(RowX, 6),6,90
Sess0.Screen.sendkeys("<enter>")
Sess0.Screen.WaitHostQuiet(5)
Replies continue below

Recommended for you

RE: Entering and Deleting values

hi,

So this is not an INQUIRY screen, it is an UPDATE screen, and hitting the ENTER key in this screen UPDATES data for this screen transaction in your mainframe?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Entering and Deleting values


Here's something to consider with respect to

CODE

Sess0.Screen.WaitHostQuiet(5) 
You are working with an asynchronous process. When you Sess0.Screen.sendkeys("<enter>"), ther is no certainty when the emulator will be ready for your input. could be less than one second; count be more than a minute. YOU DON'T KNOW!

So what with Sess0.Screen.WaitHostQuiet(5)??? You don't know if 5 is too much time, which does not SEEM to matter or if 5 is too little time, in which case your program goes ahead and enters data the the emulator is not ready to process and so IT'S LOST!

Think about it. When you drive your car, you would not even think about setting a 5 second stop wait, would you? You drive up to the stop sign and STOP, wait for 5 seconds and then GO, regardless of the traffic conditions. NOOOOOOO! You wait for visual FEEDBACK. Which is what you need to do in an asynchronous screen emulator. I like to use WaitForCursor in a loop until it returns TRUE. You'll need to Screen Rest coordinated.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Entering and Deleting values

(OP)
Hi Skip,
Yes, that's correct. We are currently using this code to input information between 4 different fields, so when the macro says <enter> the screen gets updated. Thing is...some of the information we enter becomes obsolete or expires, so we need a way of quickly removing it specific fields. Short of entering [spacebars] to clear the field, do you know of a way to delete the information with the same or a similar code, taking triggers from the Excel worksheet?

Thanks by the way, you got me again with the WaitHostQuiet - you've gotten me on that before haha, and I will be changing it...

RE: Entering and Deleting values


You need to know the length of the field on the screen. This will "clear" a 5 byte field at 3,12

CODE

Dim FieldLen as Integer
Const SPACES = "                                             "

FieldLen = 5

Sess0.Screen.PutString mid(SPACES,1,FieldLen),3,12 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Entering and Deleting values

(OP)
If I am reading this correctly, it will delete/clear the data at (r,c) regardless of my Excel worksheet, right?

RE: Entering and Deleting values



Do you see anything from your worksheet in my code?

What am I missing?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Entering and Deleting values

(OP)
You're right; that isn't quite what I was looking for. We would like to prep/scrub the data in Excel - to input and delete as necessary. I think we'll just have to input the information in Excel to update the screen, or key in the appropriate number of [spacebars] into Excel to delete the information later.

RE: Entering and Deleting values

Not necessarily.

Consider building a table in Excel that describes EVERY SCREEN that you might encounter, and then a set of routines to interpret the table, based on the screen that you are processing. Your table might look something like this...
Screen	Name	From	Thru	Col	Len
ORD01	Time	1	1	60	8
ORD01	ORDER	3	3	2	10
ORD01	PART ID	3	3	14	30
ORD01	OPER	5	20	2	4
ORD01	SETUP	5	20	8	8
ORD01	RUN	5	20	18	8
 
The Name values will correspond to the Excel Table Names in row1 for you input data.

So knowing the Len of each field, you could loop thru this table and fill each field in the input table with the correct number of spaces.

O'd use this table as the basis for mapping Excel data to and screen, rather than explicitly coding each field as your code has.

I'd be doing ALL my coding in Excel VBA!!!!

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Entering and Deleting values

this is what i use

CODE

sess.moveto 12,12
sess.sendkeys("<EraseEOF>") 

RE: Entering and Deleting values

(OP)
Hi Remy,
Yes, I would normally use <EraseEOF>, but I was wondering if there is a way to send that command through Excel...?

RE: Entering and Deleting values

tll,
my code does exactly that. the only difference is the way i declared the object.

you can try it this way.

CODE

Sess0.Screen.moveto
Sess0.Screen.sendkeys("<EraseEOF>") 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close