Friday, May 17, 2024

Back to VMS-PROMIS

After 10 years doing many other things, I am back to PROMIS running in VMS. At the start of the year I am doing a total recall, and muscle memory kicks in now and then, starting with my account name, which is one letter different. Had to get used to it ASAP, and all the other scripts that I used to run I had to recreate.

This time around, I will need to really document my learning. Will do it.

Till then.


Monday, May 11, 2015

Questions in PROMIS? Ask Me!

English: The logo of Oracle Corporation de:Bil...
English: The logo of Oracle Corporation de:Bild:Oracle-Logo.svg he:תמונה:Oracle Logo.jpg (Photo credit: Wikipedia)
English: This chart represents several constit...
English: This chart represents several constituent components of the SQL language in a single SQL Update (SQL) statement Ελληνικά: Γλωσσικά στοιχεία σε ένα statement SQL (Photo credit: Wikipedia)
12-May-2015


Hi guys!

Been some time since I posted in my blog. I am doing online business now, and I find that this is taking a lot of my time, even at home. I can't concentrate anymore on my blogs.

Not the full concentration I had then.

I ask therefore, that if you have anything you want to know about PROMIS, please drop me a comment, a question.

Then I will post the answer.

That is actually how I started in VB6 and SQL, and Oracle 10. I didn't know, but the opportunity to learn was there, and there were expert colleagues - who were not selfish nor stingy - and answered patiently every question that I raised, and even more...

Database Normalization eBook

Then my boss gave me a huge project, which I built slowly and steadily, asking even more and more questions, until I had to decide to buy an e-book, which gave me more idea, leading to more questions, and so on and so forth, until I was already designing and building applications and systems - alone.

Okay, so I believe I have put the message across: please ask me questions, and I will try to answer as objectively as possible.

Till then, thank you!

Thursday, October 30, 2014

Coming up...

Inner view of a Seagate 3.5 inches hard disk d...
Inner view of a Seagate 3.5 inches hard disk drive Medalist ST33232A model manufactured in Malaysia in 1998. Parallel ATA interface, ultra DMA mode 2, I/O data-transfer rate 33.3 MB/s max, 3,227 MB, 3 platters, 6 physical read/write heads, spindle speed 4,500 RPM, cache buffer 128 kB, MTBF 300,000 hours, dimensions 146.8 x 102.4 x 26.2 mm, weight 540 grams. (Photo credit: Wikipedia)
30-October-2014


I saved all my scripts and command files in a portable HDD, and the disk is not in very good condition after some years of heavy use. At any rate, I was able to still copy over 99.99% of my files, so coming up... the actual scripts I used.

Hope they help somebody, as it did me.

Till then!

Tuesday, October 28, 2014

PROMIS - Login

Wikipedia login page
Wikipedia login page (Photo credit: Wikipedia)
28-October-2014


Perhaps the most ignored and seemingly insignificant part of the PROMIS session is the login part. And why not? Just invoking the session, then typing in your username and password gets you in, then what you do after that is no longer needing or relating to log-in processes.

Perhaps.

But if you do a lot of scripts, and I mean not just simple scripts, but if you have multiple log-in privilege, or that the script you wrote is run by many users who log in to different terminals at the same time, and they can run the script at the same time, then this is needing the variables you use in your scripts to be singletons, or they should be user-based, or ID-based.

ID-based would sometimes be a problem, because the same script can be run by a multi-session user, and the data cannot be crossing over. Same idea as Microsoft's "sandbox" concept.

Thus, variables can be set in the login.com file. Some other files can be invoked. Messages, etc.

But most importantly, Host- or Instance-based variables can be detected and set, and this will determine what kind of session you will be having, running.

Machines are either transaction-serving or report-serving, so having that set in your login.com file will help you know right-away which session you are running, especially if you are like me, who opens 4 sessions, at the minimum. The flexibility and speed of PROMIS running in VAX-VMS is such that multi-session is no native, making you very productive.

It was just unfortunate that the time I started learning and using PROMIS, there was not much furor about SAP, which was way behind Oracle. Our company was using SAP back then, and I would have learnt it also, maybe. That was about 20 years ago.

A lot has changed since then - but not PROMIS and VMS. They remain. And while the company I now work in has decided to build their own MES by creating their own version of a Manufacturing Execution System, the concept and base knowledge I gleaned from my almost 2 decades of working in PROMIS is in such a magnitude and scope - I learned other software and programming languages in the course of time, especially when parallel dBase was introduced, and I was one of those who "qualified and stress-tested" the new system.

And even with native PROMIS datalink extraction method, my knowledge in Excel was enhanced, as there was a lot of data massaging afterwards - which all went away naturally when reports were generated using the parallel database, all running in Oracle. Which made me very comfortable navigating the tables because I know very well the structure of the ISAM files in native PROMIS, so switching to Oracle tables was a breeze, and that gave me the advantage of simply focusing on learning SQL.

I will stop here, before I digress too far away. I will present the login that make a native session come up with a unique idea that can be used as a variable for scripts that can be run at the same time by different users, or even the same user with multi-session privilege.

Till then!



Thursday, October 23, 2014

New work, new focus

JavaFX Mobile
JavaFX Mobile (Photo credit: Wikipedia)
23-October-2014


For about 5 months now, I have taken on a new job, and my focus now is more on engineering. Still, my experience as an IT practitioner is recognized, and capitalized on, from time to time.

Before I forget PROMIS, and the things that I did for the past 18 years or so, I would be documenting what I practiced, so I will have something to go back to.

Forget? Maybe not.

But it is actually the problem of forgetting the small, small things, not the major things, that causes the problem, especially as the years go by.

And, I am advancing in the years, and still learning a lot of new things: AutoCAD, Java SE 7 and 8, ASP.NET MVC, Entity Framework, C# in depth, and JavaFX. I may pick up F# soon.

Thanks to PROMIS, I learned a lot. I was forced to learn SQL, VB.NET, C#.NET and ASP.NET. So I picked up CSS and HTML in the process, and also XML. I made it good, simply because there was opportunity to learn and practice what I learned.

And what I am learning big in my new job is 'to get disturbed.'

I had to learn to stop and answer questions, or do other things, and resume what I was previously doing - seamlessly. This is one thing that I hated, and kept myself from until now.

It is, however, already a requirement of my new job, so again, given the opportunity and guidance to learn and practice this work method - I would make good at it.

New venture, and very exciting!

Till then...

Thursday, February 11, 2010

Main Form - Forms Designer Code

The old .Image via Wikipedia

For this code set, I once again checked with my IT colleague. It is readily available in .NET platform, this so-called Windows Forms Designer Code - but for VB6, you have to go to the file directory, right click on the file (.frm, in this case), then Open With 'Notepad'. Below is the code.

Now why am I so interested in getting this code set?

Many years ago, when I switched to VB .NET 2003, I happen to get a form corrupted, but I was already having a hunch on what use this 'forms designed code' is for, so I saved a copy of it. A corrupted form, having so many controls built into it, now that's some headache that won't go away in a day!

Since I can't view the form in the 'View form' mode, I viewed the code, removed everything, then did a copy-and-paste of the 'forms designer' code. If you are following this, you can guess what happened.

The form was reconstructed magically!

So that is what is keeping me interested in this 'forms designer code'. This is one of those lifelines as a software developer.


----------
VERSION 5.00
Begin VB.Form frmMain
Caption = "Call Procedure PINS List Generator"
ClientHeight = 10140
ClientLeft = 60
ClientTop = 450
ClientWidth = 13095
LinkTopic = "Form1"
ScaleHeight = 10140
ScaleWidth = 13095
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text12
Height = 285
Left = 600
TabIndex = 31
Text = "WG7OFERVAB_1ST-AT-W-00"
Top = 2160
Width = 2655
End
Begin VB.TextBox Text11
Height = 285
Left = 600
TabIndex = 30
Text = "CS42L58-CWZR/A1-WW-W-00"
Top = 1800
Width = 2655
End
Begin VB.TextBox Text10
Height = 285
Left = 3360
TabIndex = 29
Text = "JC7CDPKV_D_ST_MBI-AT-W-00"
Top = 2160
Width = 2655
End
Begin VB.TextBox Text9
Height = 285
Left = 3360
TabIndex = 28
Text = "ADL5502ACB7-J019Z-WW-W-00"
Top = 1800
Width = 2655
End
Begin VB.TextBox Text8
Height = 285
Left = 1560
TabIndex = 27
Text = "FRE003RSPR-NI-AT-W-00"
Top = 1440
Width = 3135
End
Begin VB.TextBox Text7
Height = 285
Left = 1560
TabIndex = 26
Text = "EL8176FIZ-T7-WW-W-00"
Top = 1080
Width = 3135
End
Begin VB.TextBox Text6
Height = 285
Left = 3360
TabIndex = 25
Text = "WP-CU-IPD-SP-09-EI_1X"
Top = 3000
Width = 2175
End
Begin VB.TextBox Text5
Height = 285
Left = 3360
TabIndex = 24
Text = "WP-CU-IPD-BB-09-EI_1X"
Top = 2640
Width = 2175
End
Begin VB.TextBox Text4
Height = 285
Left = 1080
TabIndex = 23
Text = "WP-CU-IPD-FC-08-EI_1X"
Top = 3000
Width = 2175
End
Begin VB.TextBox txtStatus0a
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 22
Top = 6720
Width = 4815
End
Begin VB.TextBox txtStatus0
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 19
Top = 7320
Width = 4815
End
Begin VB.TextBox txtStatus4
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1335
Left = 6690
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 9
Top = 4320
Width = 5775
End
Begin VB.TextBox txtStatus3
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1095
Left = 7050
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 8
Top = 1680
Width = 5415
End
Begin VB.TextBox txtStatus2
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 450
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 7
Top = 9120
Width = 4815
End
Begin VB.TextBox Text3
Height = 285
Left = 1560
TabIndex = 6
Text = "BF561KBCT-H33G600Z_M1-AT-B-00"
Top = 720
Width = 3135
End
Begin VB.TextBox txtStatus1
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3375
Left = 5730
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 5
Top = 6240
Width = 6735
End
Begin VB.TextBox Text2
Height = 285
Left = 1080
TabIndex = 4
Text = "EW-E1RDL-BB-03_2Y-I"
Top = 2640
Width = 2175
End
Begin VB.TextBox Text1
Height = 285
Left = 1560
TabIndex = 3
Text = "M0724-K2_DUMMYDEV_UBM-EW-0-EQ"
Top = 360
Width = 3135
End
Begin VB.TextBox tbxCallProcName
Height = 375
Left = 1710
TabIndex = 2
Text = "WP-CU-IPD-SP-09-EI_1X"
Top = 3990
Width = 3375
End
Begin VB.CommandButton btnGetFlowListing
Caption = "Get Flow Listing"
Height = 375
Left = 2400
TabIndex = 1
Top = 4455
Width = 1815
End
Begin VB.Label Label6
Caption = "Get Active Prcd ID"
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 510
TabIndex = 21
Top = 5280
Width = 1575
End
Begin VB.Label lblTPQuery0
BorderStyle = 1 'Fixed Single
Caption = "TP Query"
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Left = 480
TabIndex = 20
Top = 5640
Width = 4815
End
Begin VB.Label lblPrcdID
Caption = "PrcdID: "
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2520
TabIndex = 18
Top = 5280
Width = 3375
End
Begin VB.Label lblPinsCount
Caption = "Pins Count:"
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 11040
TabIndex = 17
Top = 5880
Width = 1455
End
Begin VB.Label lblTPQuery4
BorderStyle = 1 'Fixed Single
Caption = "TP Query"
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 6690
TabIndex = 16
Top = 3480
Width = 5775
End
Begin VB.Label lblTPQuery3
BorderStyle = 1 'Fixed Single
Caption = "TP Query"
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 7050
TabIndex = 15
Top = 720
Width = 5415
End
Begin VB.Label lblTPQuery2
BorderStyle = 1 'Fixed Single
Caption = "TP Query"
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 450
TabIndex = 14
Top = 8400
Width = 4815
End
Begin VB.Label Label4
Caption = "Get Prod Status"
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 13
Top = 8040
Width = 1935
End
Begin VB.Label Label3
Caption = "Get PINS 5xx Series"
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 7080
TabIndex = 12
Top = 360
Width = 2895
End
Begin VB.Label Label2
Caption = "Get Full PINS Data Set"
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 6720
TabIndex = 11
Top = 3120
Width = 2895
End
Begin VB.Label Label1
Caption = "Processed Result"
BeginProperty Font
Name = "Lucida Console"
Size = 6.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5760
TabIndex = 10
Top = 5880
Width = 1695
End
Begin VB.Label lblCallProcHeader
Caption = "Enter Call Proc to capture flow listing:"
Height = 255
Left = 1710
TabIndex = 0
Top = 3630
Width = 2895
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim PROMIS_LOGIN As String
Dim QueryStatus As String
Dim sCommand As String
Dim sQueue As String
Dim thisActivePrcdID As String
Const username As String = "STATSAPP"
Const password As String = "STATSAPP"
Const PROMIS_HEADER As String = "1C"
Const PROMIS_HEADER_SIZE As Integer = 8
Const PROMIS_COMMAND_SIZE As Integer = 40
Dim PipeIndex As Integer
Dim IntStr As String
Dim IntStr2 As String
Dim myCurrPinsDataSet(300, 7) As String


Private Sub btnGetFlowListing_Click()
txtStatus0.Text = ""
txtStatus0a.Text = ""
lblTPQuery0 = ""
txtStatus1.Text = ""
lblTPQuery2 = ""
txtStatus2.Text = ""
lblTPQuery3 = ""
txtStatus3.Text = ""
lblTPQuery4 = ""
txtStatus4.Text = ""
Me.lblPinsCount = "Pins Count: "
GetPinsData (Me.tbxCallProcName.Text)
End Sub

Private Sub Form_Load()
Dim status As Long
' Always call pams_exit on startup. This avoids
' leaving open connections if the app is stopped
' from VB run-mode without detaching.
'
status = pams_exit()

#If MessageQ_Server Then
txtStatus1.Text = "MessageQ Server environment"
#Else
txtStatus1.Text = "MessageQ Client environment"
#End If
End Sub


Function GetPinsData(ByVal myProcName As String) As Integer
Dim status As Long
Dim ReturnedData As Integer
'
GetPins500Series = 0
ReturnedData = 0
' attach Q
status = DmqAttachQ()
If (status <> 1) Then
' error attaching Q
txtStatus1.Text = "Error attaching Q"
Else
' means status is OK
' put msg
' query: "GetActivePrVersion"
QueryStatus = ""
Sleep (100)
Call PutMsg4(myProcName, "GetActivePrVersion", lblTPQuery0)
' get Msg
Sleep (100)
QueryStatus = GetMsg4(txtStatus0a)
' assign a default value for the Prcd Name
thisActivePrcdID = myProcName
' process the data
If (InStr(QueryStatus, "SUCCESS") > 0) Then
ReturnedData = Me.CleanSingleColumnTPResult(QueryStatus, txtStatus0)
If (ReturnedData > 0) Then
lblPrcdID = "PrcdID: " & txtStatus0.Text
thisActivePrcdID = txtStatus0.Text
Else
thisActivePrcdID = myProcName
End If
End If
' put Msg
' query: "CheckProdStatus"
QueryStatus = ""
Sleep (100)
Call PutMsg4(thisActivePrcdID, "CheckProdStatus", lblTPQuery2)
' get Msg
Sleep (100)
QueryStatus = GetMsg4(txtStatus2)
' put Msg
' query: "GetPins500Series"
QueryStatus = ""
Sleep (200) ' safe number, especially when the # of rows is increasing
Call PutMsg4(thisActivePrcdID, "GetPins500Series", lblTPQuery3)
' get Msg
Sleep (300) ' safe number, especially when the # of rows is increasing
QueryStatus = GetMsg4(txtStatus3)
' put Msg
' query: "GetFullPINSSet"
QueryStatus = ""
Sleep (400) ' safe number, especially when the # of rows is increasing
Call PutMsg4(thisActivePrcdID, "GetFullPINSSet", lblTPQuery4)
' get Msg
Sleep (500) ' safe number, especially when the # of rows is increasing
QueryStatus = GetMsg4(txtStatus4)
' process the data
If (InStr(QueryStatus, "SUCCESS") > 0) Then
GetPinsData = CleanCurrPinsDataSet(QueryStatus, txtStatus1)
If (GetPinsData > 0) Then
' show the full data set
'MsgBox ("Number of PINS is " & GetPinsData)
Me.lblPinsCount = "Pins Count: " & GetPinsData
End If
End If
End If
' detach Q, whether failed or succeeded
DmqExit
' clean up the msg, and return how many are captured
End Function

Sub PutMsg4(ByVal DataBuffer As String, ByVal ComType As String, ByVal thisLabel As Label)
Dim status As Long
Dim MsgArea As String * 4096

PutMsg.SrcTarget.Group = 1
PutMsg.SrcTarget.Queue = 4
PutMsg.Class = 0
PutMsg.Type = 0
PutMsg.timeout = 60000
PutMsg.MsgAreaSize = Len(MsgArea)

MsgArea = Compose1(DataBuffer, ComType)
thisLabel = MsgArea

status = DmqPutMsg(PutMsg, MsgArea)
End Sub

Function GetMsg4(ByVal thisControl As TextBox) As String
Dim status As Long
Dim MsgArea As String * 8192
thisControl.Text = ""
GetMsg.timeout = 900
GetMsg.MsgAreaSize = Len(MsgArea)
status = DmqGetMsg(GetMsg, MsgArea)
If (status = PAMS__NOMOREMSG) Then
thisControl.Text = thisControl.Name + ": " + DmqStatusText(status)
ElseIf (status = PAMS__SUCCESS) Then
thisControl.Text = thisControl.Name + ": " + MsgArea
Else
thisControl.Text = thisControl.Name + ": " + "GetMsg status: " + DmqStatusText(status)
End If
GetMsg4 = MsgArea
End Function

Function Compose1(ByVal DataBuffer As String, ByVal ComType As String) As String
PROMIS_LOGIN = "USERID " + username + "|PWD " + password + "|"
Compose1 = ""
Select Case ComType
Case "GetActivePrVersion"
VarProds = "LOWID " & DataBuffer & "|HIGHID " & DataBuffer & "|"
sCommand = "PROPRCD_LIST"
sQueue = VarProds + "FROM PRCDSET|" & _
"WHERE PRODSTATUS EQ 'A' AND ACTIVEFLAG EQ 'A'|" & _
"SHOW EXTERN(PRCDID)|"
Case "GetPins500Series"
VarProds = "PRCDID " + DataBuffer + "|"
sCommand = "PROPRCD_GETPRCD_INSTRUCTIONS"
sQueue = VarProds + "NUMBERINSTRUCTIONS 100|FROM PINSSET|" & _
"WHERE (PINSINSTNUM GE '500.000' AND PINSINSTNUM LT '595.000')|" & _
"SHOW PINSINSTNUM|SHOW INSTTYPE|SHOW STAGE|SHOW EXECUTERECPID|" & _
"SHOW LOCATIONID|SHOW CALLPRCDID|"
Case "GetFullPINSSet"
VarProds = "PRCDID " + DataBuffer + "|"
sCommand = "PROPRCD_GETPRCD_INSTRUCTIONS"
sQueue = VarProds + "NUMBERINSTRUCTIONS 300|FROM PINSSET|" & _
"SHOW PINSINSTNUM|SHOW INSTTYPE|SHOW EXECUTERECPID|SHOW STAGE|" & _
"SHOW LOCATIONID|SHOW CALLPRCDID|"
Case "CheckProdStatus"
VarProds = "PRCDID " + DataBuffer + "|"
sCommand = "PROPRCD_GETPRCD_HEADER"
sQueue = VarProds + "SHOW PRCD.PRODSTATUS|"
End Select
Compose1 = Me.FormQuery(sCommand, sQueue)
End Function

Public Function FormQuery(ByVal sCommand As String, ByVal sQueue As String) As String
FormQuery = PROMIS_HEADER & Space(PROMIS_HEADER_SIZE - Len(PROMIS_HEADER)) & _
Trim(sCommand) & Space(PROMIS_COMMAND_SIZE - Len(Trim(sCommand))) & _
"|" & PROMIS_LOGIN & sQueue & "END|"
End Function

Public Function CleanSingleColumnTPResult(ByVal thisReplyMsg As String, ByVal thisTextBox As TextBox) As Integer
Dim thisBuffer As String
Dim thisCntr As Integer
thisBuffer = ""
thisCntr = 0
CleanSingleColumnTPResult = 0
thisTextBox.Text = ""
'
PipeIndex = InStr(1, thisReplyMsg, "|")
IntStr = Right(thisReplyMsg, (Len(thisReplyMsg)) - PipeIndex)
PipeIndex = InStr(1, IntStr, "|")
thisCntr = Left(IntStr, (PipeIndex - 1))
'
If (thisCntr <> "0") Then
For i = 0 To (thisCntr - 1)
IntStr2 = Right(IntStr, (Len(IntStr)) - PipeIndex)
PipeIndex = InStr(1, IntStr2, "|")
thisBuffer = Left(IntStr2, PipeIndex - 1)
IntStr = IntStr2
myCurrPinsDataSet(i, 0) = thisBuffer
thisTextBox.Text = thisBuffer
Next
CleanSingleColumnTPResult = thisCntr
Else
CleanSingleColumnTPResult = 0
End If
End Function

Public Function CleanCurrPinsDataSet(ByVal thisReplyMsg As String, ByVal thisTextBox As TextBox) As Integer
Dim thisBuffer As String
Dim thisCntr As Integer
thisBuffer = ""
thisCntr = 0
CleanCurrPinsDataSet = 0
thisTextBox.Text = ""
'
PipeIndex = InStr(1, thisReplyMsg, "|")
IntStr = Right(thisReplyMsg, (Len(thisReplyMsg)) - PipeIndex)
PipeIndex = InStr(1, IntStr, "|")
thisCntr = Left(IntStr, (PipeIndex - 1))
'
If (thisCntr <> "0") Then
For i = 0 To (thisCntr - 1)
For j = 0 To 5
IntStr2 = Right(IntStr, (Len(IntStr)) - PipeIndex)
PipeIndex = InStr(1, IntStr2, "|")
thisBuffer = Left(IntStr2, PipeIndex - 1)
IntStr = IntStr2
If (j = 0) Then
myCurrPinsDataSet(i, j) = thisBuffer
ElseIf (j = 1) Then
myCurrPinsDataSet(i, j) = thisBuffer
ElseIf (j = 2) Then
myCurrPinsDataSet(i, j) = thisBuffer
ElseIf (j = 3) Then
myCurrPinsDataSet(i, j) = thisBuffer
ElseIf (j = 4) Then
myCurrPinsDataSet(i, j) = thisBuffer
ElseIf (j = 5) Then
myCurrPinsDataSet(i, j) = thisBuffer
End If
Next
Next
CleanCurrPinsDataSet = thisCntr
' do the textbox population here, so main code is clean
' current data set:
' 0 - Inst Num (7 chars, into 8)
' 1 - Inst Type (2 chars, into 3)
' 2 - Exec Recipe (5 chars, into 6)
' 3 - Stage (max 10 chars, into 11)
' 4 - LocationID (max 10 chars, into 11)
' 5 - Call Prcd (max 32 chars, into 33)
Dim tmpPinsBfr As String
' assign the header in the Textbox
thisTextBox.Text = "InstNum -Ityp -Recipe - StageID - LocationID - Call Procedure Name " & vbCrLf & _
"======= -==== -====== - ======= - ========== - =================== " & vbCrLf
For i = 0 To (thisCntr - 1)
For j = 0 To 5
If (j = 0) Then
thisTextBox.Text = thisTextBox.Text & myCurrPinsDataSet(i, j)
ElseIf (j = 1) Then
thisTextBox.Text = thisTextBox.Text & " - " & myCurrPinsDataSet(i, j)
ElseIf (j = 2) Then
tmpPinsBfr = myCurrPinsDataSet(i, j)
If (tmpPinsBfr = "") Then tmpPinsBfr = "Undef"
thisTextBox.Text = thisTextBox.Text & " - " & tmpPinsBfr & Space(6 - Len(tmpPinsBfr))
ElseIf (j = 3) Then
tmpPinsBfr = myCurrPinsDataSet(i, j)
If (tmpPinsBfr = "") Then tmpPinsBfr = "Undef"
thisTextBox.Text = thisTextBox.Text & " - " & tmpPinsBfr & Space(11 - Len(tmpPinsBfr))
ElseIf (j = 4) Then
tmpPinsBfr = myCurrPinsDataSet(i, j)
If (tmpPinsBfr = "") Then tmpPinsBfr = "Undef"
thisTextBox.Text = thisTextBox.Text & " - " & tmpPinsBfr & Space(11 - Len(tmpPinsBfr))
ElseIf (j = 5) Then
tmpPinsBfr = myCurrPinsDataSet(i, j)
If (tmpPinsBfr = "") Then tmpPinsBfr = "Undef"
thisTextBox.Text = thisTextBox.Text & " - " & tmpPinsBfr & Space(33 - Len(tmpPinsBfr)) & vbCrLf
End If
Next
Next
Else
CleanCurrPinsDataSet = 0
End If
End Function

----------
Reblog this post [with Zemanta]