Jump to content
Macro Express Forums

Help Please Using Switch And Case


m204prgmr

Recommended Posts

Good morning,

I am at a brick wall in trying to finish this comma delimited output and can use some help. Attached is a snippet of EPILOG1152006.txt, the document I am processing. In it are blocks of information for each job with the prefix TSI that the mainframe runs in batch. Some of the blocks of information will contain WAITING FOR CPU or they will contain ECB WAIT (W/ STIMER) or they will contain SWAPPED WITH WTOR. And some blocks may contain one or two or maybe all three of the above. In the attachment, all three do not appear in the same block, that I have found.

My problem it seems is I am only capturing SWAPPED WITH WTOR and when that happens, there is a second identical line printed but without SWAPPED WITH WTOR.

I would like to capture any or all of th above that appear in each block.

 

I don't know how to use SWITCH or if it will help. The example in HELP is vague to me and does not show the code of how to do a TEXT DISPLAY. Or I am really missing it. I toyed with using OR and ELSE but maybe I am not using them correctly.

 

Thanks and I hope everyone has a great Sunday. The code is below my signature

Robert

 

 

<TVAR2:10:01:,><IFOTH:01:2:C:\Epilog\testmeomega.txt><DOFILE:08:NN:C:\Epilog\testmeomega.txt>><ENDIF><IFOTH:09:2:C:\Epilog\testmeomega.txt><TMVAR2:20:02:00:000:000:C:\Epilog\testmeomega.txtF><ENDIF><TVAR2:20:01:Job Name,ELAP,Start/Stop,Date,Waiting for CPU><TMVAR2:20:20:00:000:000:C:\Epilog\testmeomega.txtT><TVAR2:21:01:,,,,,><TMVAR2:20:21:00:000:000:C:\Epilog\testmeomega.txtT><BTFBEG:001:000001:000000:C:\Epilog\EPILOG1152006.txt><IFVAR2:1:01:7:JES><TMVAR2:11:01:00:001:008:><TMVAR2:10:02:01:001:008:><TMVAR2:08:02:10:000:000:><ENDIF><REM2:****** Get ELAP Time, Start and Stop Time, Date of run (start and stop time = same date ******><IFVAR2:1:01:7:FROM><IVAR2:01:13:1:ON><TMVAR2:10:15:01:028:050:><IVAR2:02:13:15:ON><IFVAR2:2:01:1:27><TMVAR2:10:03:01:065:008:><TMVAR2:08:03:10:000:000:><TMVAR2:07:02:00:000:000:%T3%><TMVAR2:10:04:01:011:015:><TMVAR2:08:04:10:000:000:><TMVAR2:07:02:00:000:000:%T4%><TMVAR2:10:05:01:029:009:><TMVAR2:08:05:10:000:000:><TMVAR2:07:02:00:000:000:%T5%><ENDIF><IFVAR2:2:02:1:12><REM2:****** Get ELAP Time, Start and Stop Time, Date of run (start and stop time = date roll over ******><TMVAR2:10:06:01:065:007:><TMVAR2:08:06:10:000:000:><TMVAR2:07:02:00:000:000:%T6%><TMVAR2:10:07:01:011:006:><TVAR2:25:01: TO><TMVAR2:08:07:25:000:000:><TMVAR2:07:02:00:000:000:%T7%><TMVAR2:10:08:01:032:006:><TMVAR2:08:08:10:000:000:><TMVAR2:07:02:00:000:000:%T8%><TMVAR2:10:09:01:020:008:><TMVAR2:08:09:25:000:000:><TMVAR2:07:02:00:000:000:%T9%><TMVAR2:10:11:01:041:009:><TMVAR2:08:11:10:000:000:><TMVAR2:07:02:00:000:000:%T11%><ENDIF><TMVAR2:20:02:00:000:000:C:\Epilog\testmeomega.txtT><ENDIF><REM2:****** Get Delay information ******><TMVAR2:10:50:01:002:017:><IFVAR2:1:50:7:SWAPPED><TMVAR2:10:12:01:002:020:><TMVAR2:08:12:10:000:000:><TMVAR2:07:02:00:000:000:%T12%><TMVAR2:20:02:00:000:000:C:\Epilog\testmeomega.txtT><ELSE><IFVAR2:1:50:7:ECB WAIT (W/ STIMER)><TMVAR2:10:12:01:002:020:><TMVAR2:08:12:10:000:000:><TMVAR2:07:02:00:000:000:%T12%><TMVAR2:20:02:00:000:000:C:\Epilog\testmeomega.txtT><ELSE><IFVAR2:1:50:1:WAITING FOR CPU><TBOX4:T:1:CenterCenter000278000200:000:%T50%><TMVAR2:10:12:01:002:020:><TMVAR2:08:12:10:000:000:><TMVAR2:07:02:00:000:000:%T12%><TMVAR2:20:02:00:000:000:C:\Epilog\testmeomega.txtT><ENDIF><ENDIF><ENDIF><BTFEND><LAUNCHDEL2:0:01C:\Epilog\testmeomega.txt>

EPILOG1152006.txt

Link to comment
Share on other sites

Bob -

 

The Switch/End Switch construct can only be used for an exact string or number comparison. It does not allow for "contains". Also, string comparisons are case sensitive.

 

Looking at your code, it appears that you are attempting to pull certain strings, in the order they appear, and place them in some type of structured CSV file. I can only assume that each line in the CSV file is based on the next "JES" section of the text file. Is this correct?

 

If so, and if the "WAITING FOR CPU", "ECB WAIT" and "SWAPPED WITH WTOR" lines all come after the current "JES" line and before the next "JES" line, then you should be able to use the IF/End If construct, along with OR logic commands, to parse the data.

 

Do you have an example of the output CSV file you are generating?

Link to comment
Share on other sites

Hi Joe,

You are correct in that, the blocks start with JES and I am looking for certain bits of information from certain lines before the next JES.

 

I will include at the bottom of this reply the updated code where I am only grabbing any WAITING FOR CPU messages. I wanted to keep moving forward and was uncertain if anyone would reply to my original. The attached is the generated output. Notice in the output that, if there is a value the 5th column, the line just before it is a duplicate. I need to eliminate the duplicate too.

 

thanks,

Robert

 

<TVAR2:10:01:,><IFOTH:01:2:C:\Epilog\testmeomega1.txt><DOFILE:08:NN:C:\Epilog\testmeomega.txt>><ENDIF><IFOTH:09:2:C:\Epilog\testmeomega1.txt><TMVAR2:20:99:00:000:000:C:\Epilog\testmeomega.txtF><ENDIF><TVAR2:20:01:Job Name,ELAP,Start/Stop,Date,Waiting for CPU><TMVAR2:20:20:00:000:000:C:\Epilog\testmeomega.txtT><TVAR2:21:01:,,,,,><TMVAR2:20:21:00:000:000:C:\Epilog\testmeomega.txtT><BTFBEG:001:000001:000000:C:\Epilog\EPILOG1152006.txt><IFVAR2:1:01:7:JES><TMVAR2:11:01:00:001:008:><TMVAR2:10:02:01:001:008:><TMVAR2:08:02:10:000:000:><ENDIF><REM2:****** Get ELAP Time, Start and Stop Time, Date of run (start and stop time = same date ******><TMVAR2:10:95:01:003:004:><IFVAR2:1:95:1:FROM><IVAR2:01:13:1:ON><TMVAR2:10:15:01:028:050:><IVAR2:02:13:15:ON><IFVAR2:2:01:1:27><TMVAR2:10:03:01:065:008:><TMVAR2:10:04:01:011:015:><TMVAR2:10:05:01:029:009:><TMVAR2:08:03:10:000:000:><TMVAR2:08:04:10:000:000:><TMVAR2:08:05:10:000:000:><TMVAR2:07:02:00:000:000:%T3%><TMVAR2:07:02:00:000:000:%T4%><TMVAR2:07:02:00:000:000:%T5%><DIS:<TMVAR2:20:02:00:000:000:C:\Epilog\testmeomega.txtT><ENDIF><DIS:<TMVAR2:20:02:00:000:000:C:\Epilog\testmeomega.txtT><IFVAR2:2:02:1:12><REM2:****** Get ELAP Time, Start and Stop Time, Date of run (start and stop time = date roll over ******><TMVAR2:10:06:01:065:007:><TMVAR2:08:06:10:000:000:><TMVAR2:07:02:00:000:000:%T6%><TMVAR2:10:07:01:011:006:><TVAR2:25:01: TO><TMVAR2:08:07:25:000:000:><TMVAR2:10:08:01:032:006:><TMVAR2:10:09:01:020:008:><TMVAR2:10:11:01:041:009:><TMVAR2:08:08:10:000:000:><TMVAR2:08:09:25:000:000:><TMVAR2:08:11:10:000:000:><TMVAR2:07:02:00:000:000:%T7%><TMVAR2:07:02:00:000:000:%T8%><TMVAR2:07:02:00:000:000:%T9%><TMVAR2:07:02:00:000:000:%T11%><DIS:<TMVAR2:20:02:00:000:000:C:\Epilog\testmeomega.txtT><ENDIF><TMVAR2:20:02:00:000:000:C:\Epilog\testmeomega.txtT><ENDIF><VARSR:02><REM2:****** Get CPU Delay information ******><IFVAR2:1:01:7:WAITING FOR CPU><TMVAR2:10:06:01:023:007:><DIS:<TMVAR2:08:06:10:000:000:><TMVAR2:07:02:00:000:000:%T6%><TMVAR2:20:02:00:000:000:C:\Epilog\testmeomega.txtT><DIS:<TBOX4:T:1:CenterCenter000278000200:000:%T1%><ENDIF><BTFEND><LAUNCHDEL2:0:01C:\Epilog\testmeomega.txt>

test_meomega_for_forum.txt

Link to comment
Share on other sites

Bob -

 

It appears that the Switch/End Switch contruct won't do you any good here. It seems that all of your saved information is coming from the "JES" and "FROM" lines. I do not understand why you would even need to parse the "WAITING FOR CPU", "ECB WAIT" and "SWAPPED WITH WTOR" lines.

Link to comment
Share on other sites

Sure can ... it is happening within the "****** Get CPU Delay information ******" section. You've processed the "JES" and the "FROM" lines. But when the current line (in the subsequent loops) contains one of the three choices it gets processed, too.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...