View previous topic :: View next topic
|
Author |
Message |
Rajesh N
New User
Joined: 29 Nov 2012 Posts: 2 Location: India
|
|
|
|
Hi,
I have a requirement in which I need to list down all the members in a PDS which have consecutive strings in the given order.
For eg.,
I want to search all the members in the partitioned dataset TEST.DATASET.PDS having the below strings in the same order:
AAAA
BBBB
If two members MEMBER1 an MEMBER2 are having the above strings in the same order, I want the member names to be listed in the output.
Found similar topic in th below URL:
ibmmainframes.com/viewtopic.php?p=305088#305088
But this has a solution in which consective strings if preset in a PS file will be copied to other PS file.
Is there any possible solution for my requirement? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Duplicate post on same forum topic needs to be deleted |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10891 Location: italy
|
|
|
|
wonders of the language barrier ... the TS just found his other topic on the same subject |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Why are you going in circles?
The other URL, is not a "solution" as you say it - unless 'am mistanken Bill is just trying to find the level of DFSort your shop is at.
For the question, you can possibly try with ISPF 3.14 (Search-For) also. I recall that it provided the facility to search for consecutive strings. But you might need to expriment, I've not verified it. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
The following needs to be run and the output posted as Bill requested in the "Other" topic. Which is being locked.
Bill Woodger wrote: |
You want to do this in Sort? Can you run this:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN DD *
OPTION COPY
/* |
and post the full sysout for the step, in the Code tags please. |
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10891 Location: italy
|
|
|
|
pretty easy with an edit macro
issue a find for AAA
if found fetch the next line and check if it contains BBB |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10891 Location: italy
|
|
|
|
terrific good mood on
here are two edit macros who will do it
the outer macro
Code: |
EDIT ENRICO.ISPF.EXEC(MF000) - 01.08 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000002 /* */
000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000004 Trace "O"
000005
000006 Parse Source _sys _how _cmd .
000007
000008 If Sysvar(SYSISPF) \= "ACTIVE" Then Do
000009 Say left(_cmd,8)"- Ispf is not active. Command not executed"
000010 Exit 4
000011 End
000012
000013 call $ispex "CONTROL ERRORS RETURN"
000014
000015 if $isred("MACRO (ZPARMS) NOPROCESS ") \= 0 then do
000016 zerrsm = "Invocation ERROR"
000017 zerrlm = left(_cmd,8)"- Must be invoked as an edit macro"
000018 call $ispex "SETMSG MSG(ISRZ001) "
000019 Exit 1
000020 end
000021
000022 call $isred "(DATASET) = DATASET"
000023 call $isred "(CURRNT) = MEMBER"
000024 call $isred "(DATAID) = DATAID"
000025 call $isred "DELETE .ZFIRST .ZLAST"
000026
000027 lmo_rc = $ispex("LMOPEN DATAID("dataid") OPTION(INPUT) ")
000028
000029 coun0 = 0
000030 count = 0
000031 member = ""
000032
000033 lmmlist = "LMMLIST DATAID("dataid") OPTION(LIST) MEMBER(MEMBER) "
000034 do while ($ispex(lmmlist) = 0 )
000035 if strip(member) \= strip(currnt) then do
000036 view = "VIEW DATAID("dataid") MEMBER("member") MACRO(MF001) "
000037 call $ispex view
000038 call $ispex "VGET (HAVE,LINE)"
000039 if have = 0 then do
000040 coun0 = coun0 + 1
000041 done = "FOUND AT" LINE
000042 end
000043 else
000044 done = "NOT FOUND"
000045 count = count + 1
000046 wout = left(done,20) dataset"("member")"
000047 call $isred "LINE_AFTER .ZLAST = DATALINE (wout) "
000048 end
000049 end
000050
000051 lmo_rc = $ispex("LMMLIST DATAID("dataid") OPTION(FREE) " )
000052 lmo_rc = $ispex("LMCLOSE DATAID("dataid") " )
000053
000054 zedsmsg = left(_cmd,8)"- Done "count"/"coun0
000055 zedlmsg = left(_cmd,8)"- " || count"/"coun0 || " Members Matching"
000056 call $ispex "SETMSG MSG(ISRZ000) "
000057
000058 Exit 1
000059
000060 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000061 /* */
000062 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000063 $ispex:
000064 isp_0tr = trace("O")
000065 Address ISPEXEC arg(1)
000066 isp_0rc = rc
000067 trace value(isp_0tr)
000068 return isp_0rc
000069
000070 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000071 /* */
000072 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000073 $isred:
000074 isr_0tr = trace("O")
000075 Address ISREDIT arg(1)
000076 isr_0rc = rc
000077 trace value(isr_0tr)
000078 return isr_0rc
000079
000080 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000081 /* */
000082 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000083 $tsoex:
000084 tso_0tr = trace("O")
000085 Address TSO arg(1)
000086 tso_0rc = rc
000087 trace value(tso_0tr)
000088 return tso_0rc
000089
****** **************************** Bottom of Data **************************** |
the inner macro
Code: |
EDIT ENRICO.ISPF.EXEC(MF001) - 01.11 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000002 /* */
000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000004 Trace "O"
000005
000006 Parse Source _sys _how _cmd .
000007 If ( Sysvar(SYSISPF) \= "ACTIVE" ) Then Do
000008 Say left(_cmd,8)"- Ispf is not active. Command not executed"
000009 exit 4
000010 End
000011
000012 call $ispex "CONTROL ERRORS RETURN"
000013
000014 if ( $isred("MACRO (ARGS) NOPROCESS ") \= 0 ) then do
000015 zedsmsg = "Invocation ERROR"
000016 zedlmsg = left(_cmd,8)"- Must be invoked as a MACRO"
000017 call $ispex "SETMSG MSG(ISRZ001)"
000018 exit 4
000019 end
000020
000021 call $isred "LABEL .ZFIRST = .WFIRST"
000022 call $isred "(WLAST) = LINENUM .ZLAST"
000023 call $isred "LABEL " wlast-1 " = .WLAST"
000024 where = "FIRST"
000025 do while ( $isred("FIND 'AAA' .WFIRST .WLAST " where) = 0 )
000026 where = "NEXT"
000027 call $isred "(WLINE) = CURSOR"
000028 call $isred "(WDATA) = LINE" wline+1
000029 if pos('BBB',wdata) > 0 then do
000030 have = 0
000031 call $ispex "VPUT (HAVE,LINE)"
000032 call $isred "END"
000033 exit 0
000034 end
000035 end
000036 have = 4
000037 line = 0
000038 call $ispex "VPUT (HAVE,LINE)"
000039 call $isred "END"
000040 Exit 0
000041
000042 /* */
000043 $tsoex:
000044 tso_0tr = trace("O")
000045 Address TSO arg(1)
000046 tso_0rc = rc
000047 trace value(tso_0tr)
000048 return tso_0rc
000049
000050 /* */
000051 $ispex:
000052 isp_tr = trace("O")
000053 Address ISPEXEC arg(1)
000054 isp_rc = rc
000055 trace value(isp_tr)
000056 return isp_rc
000057
000058 /* */
000059 $isred:
000060 isr_tr = trace("O")
000061 Address ISREDIT arg(1)
000062 isr_rc = rc
000063 trace value(isr_tr)
000064 return isr_rc
000065
****** **************************** Bottom of Data **************************** |
the samples
Code: |
EDIT ENRICO.MFTESTS.PDS1(A) - 01.02 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 AAA
000002 AAA
000003 BBB
000004 AAA
****** **************************** Bottom of Data **************************** |
Code: |
EDIT ENRICO.MFTESTS.PDS1(B) - 01.00 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 AAA
000002 AAA
000003 AAA
000004 BBB
****** **************************** Bottom of Data **************************** |
Code: |
EDIT ENRICO.MFTESTS.PDS1(C) - 01.00 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 AAA
000002 AAA
000003 AAA
****** **************************** Bottom of Data ****************************
|
the result
Code: |
EDIT ENRICO.MFTESTS.PDS1(Z) - 01.05 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 FOUND AT 00000002 ENRICO.MFTESTS.PDS1(A )
000002 FOUND AT 00000003 ENRICO.MFTESTS.PDS1(B )
000003 NOT FOUND ENRICO.MFTESTS.PDS1(C )
****** **************************** Bottom of Data **************************** |
to use it ...
save the two REXX scripts in a library in Ypur sysproc concatenation
go to the PDS in question
start editing an empty member ... et voila' |
|
Back to top |
|
|
|