9
Answers

Problems with mainframe emulator using EHLLAPI

Photo of Brian

Brian

14y
11.5k
1

Hi there,
I am using EHLLAPI to connect to a mainframe emulator.  I can connect to the session and do some major commands (e.g. connect, disconnect, get cursor, set cursor, sendkey, copy ps to string, etc.).  The emulator is Rumba version 5.2.  What I can't get my Windows app to do is to chain a bunch of commands together.  For example: I want to loop where I use Sendkey, then SetCursor, the Sendkey, SetCursor, Copy PS to String, etc.).  I can't get the chain of commands to work, only the first two or so work and then nothing.  Thanks in advance.

Answers (9)

0
Photo of Dharmraj Thakur
NA 4.1k 61.7k 7y
Do not execute this query directly first understand all statements and thing about your requirement... here is basic queries, let me know next queries later after understanding this...
  1. --get current stock of product  
  2. Select ProductID, ProductName, ClosingStockQTy, ClosingStockRs from ProductMaster where Product = 1  
  3.   
  4. --on purchase add stock  
  5. insert into Purchases (BillNo, BillDate, ProductID, Rate, Discount, Qty, TotalAmount)  
  6. values  
  7. (  
  8.     'CP1',  
  9.     getdate(),  
  10.     @ProductID,  
  11.     @Rate,  
  12.     @Discount,  
  13.     @Qty,  
  14.     @TotalAmount  
  15. )  
  16.   
  17. declare @StockQTy as int=0;  
  18. set @StockQTy = (select top 1 ClosingStockQty from ProductMaster where ProductID = 1);  
  19. set @StockQTy = @StockQTy + @Qty;  
  20.   
  21. Update ProductMaster  
  22. set  
  23.     ClosingStockQTy = @StockQTy  
  24. Where  
  25.     ProductID = 1  
  26.   
  27.   
  28. --on sale decrease stock  
  29. insert into Sales (BillNo, BillDate, ProductID, Rate, Discount, Qty, TotalAmount)  
  30. values  
  31. (  
  32.     'CS1',  
  33.     getdate(),  
  34.     @ProductID,  
  35.     @Rate,  
  36.     @Discount,  
  37.     @Qty,  
  38.     @TotalAmount  
  39. )  
  40.   
  41. declare @StockQTy as int=0;  
  42. set @StockQTy = (select top 1 ClosingStockQty from ProductMaster where ProductID = 1);  
  43. set @StockQTy = @StockQTy - @Qty;  
  44.   
  45. Update ProductMaster  
  46. set  
  47.     ClosingStockQTy = @StockQTy  
  48. Where  
  49.     ProductID = 1
0
Photo of Ramesh Barik
NA 639 90 7y
You can use inner join and left join to get the result.
  1. select PM.ProductID, PM.ProductName, PM.MRP,  
  2. Purchase.BillDate as PurchaseBillDate,Purchase.Rate as PurchaseRate,  
  3. Sales.BillDate as SalesBillDate,Sales.Rate as SalesRate  
  4. from Productmaster PM  
  5. inner join Purchase on PM.ProductID=Purchase.ProductID  
  6. left join Sales on PM.ProductID = Sales.ProductID  
  7. where PM.ProductID= 1000