Page 1 of 1

Finding Comp fields in a PS ISPF

PostPosted: Tue Mar 24, 2009 11:17 pm
by naresh_ceg
What would be the syntax to find a field stored as COMP binary in a PS?

For ex. if the field is declared as PIC 9(9) USAGE IS COMP. If the value stored is say 123, how do i find that in ISPF Editor.

In the ex if the usage is comp-3 hex, then my i would use F X'000000123C'. Please tell me the equivalent command for COMP usage.

Re: Finding Comp fields in a PS ISPF

PostPosted: Wed Mar 25, 2009 12:10 am
by dick scherrer
Hello and welcome to the forum,

Decimal 123 is x'7B' in binary. F X'7B' should find it.

Re: Finding Comp fields in a PS ISPF

PostPosted: Wed Mar 25, 2009 12:36 am
by naresh_ceg
Thanks Dick Scherrer for your reply. My elaborated need is to find out the first occurence of this binary field 123 in the PS file, and insert a line next to the current cursor position incrementing by 1 ie 124.

For ex. If the file has these records,
ABCD123XYZ
BCDE456MOP
CDEF678ZYX

Only this number field is defined as binary, the row has many other fields in hex, char formats apart from the field i need to increment.
Then my expected output is

ABCD123XYZ
ABCD124XYZ
BCDE456MOP
CDEF678ZYX

So if i'm accomplishing this with ISPF edit macros and Rexx. I should basically convert this 123 into binary (D2X followed by X2B) and find the first occurence of it in the file. Use Getline command to copy the data of the entire row. Use Parse Arg to split and then update the incremented no. in the correct position in binary format. And then finally insert using Line_After command from the .ZCSR position.

Please let me know if there are better ways to do this and this seems mundane. Thanks for your help!

Re: Finding Comp fields in a PS ISPF

PostPosted: Wed Mar 25, 2009 1:44 am
by dick scherrer
Hello,

I should basically convert this 123 into binary (D2X followed by X2B)
Quite confusing. . . If the value is 123 and the field is binary, it will already be x'7b'. . .

Also, if you scan the "input" for some x'..' value anywhere in the record, you will get "hits" in places you will not want. . . For example, the x'7b' is the #. . . x'c1' (193) is the letter A.

You might want to consider writing this in cobol and using the actual record layout in the code. I believe it will be easier to implement and far easier to maintain.