MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to select a block of records from the file ?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Fri Jun 13, 2008 2:42 pm    Post subject: how to select a block of records from the file ? Reply with quote

Hi,
I am having a fb file of lrecl 80 with the as shown below.

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ark
a
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ack
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ark
a
a
a
a
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

I want to create the o/p file with the block which is having RK.

o/p

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ark
a
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ark
a
a
a
a
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

can we do it with sort ?
_________________
----------------
Thanks&Regards
Bprasanna
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Jun 13, 2008 4:40 pm    Post subject: Reply with quote

bprasanna,

How do you identify the block to be copied?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Sat Jun 14, 2008 1:27 pm    Post subject: Reply with quote

Hi Kolusu,
The block starts always with 'aaaa...' .
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

and the second line will be 'ark'

ark

After that there might be 'n' number of 'a's .

a
a
.
.

Finally the block ends with 'aaaa...'

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


Thanks
Bprasanna
_________________
----------------
Thanks&Regards
Bprasanna
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Jun 16, 2008 10:55 am    Post subject: Reply with quote

bprasanna,

If 'aaaaaa' is a fixed string which completes the block then the following DFSORT/ICETOOL jcl will give you the desires results.

Code:

//STEP0100 EXEC PGM=ICETOOL             
//TOOLMSG  DD SYSOUT=*                 
//DFSMSG   DD SYSOUT=*                 
//IN       DD *                         
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA     
ARK  -PICK01                           
A    -PICK02                           
A    -PICK03                           
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA     
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA     
ACK                                     
A                                       
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA     
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA     
ARK -PICK04                             
A   -PICK05                             
A   -PICK06                             
A   -PICK07                             
A   -PICK08                             
A   -PICK09                             
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA     
//OUT      DD SYSOUT=*                                     
//TOOLIN   DD *                                             
  SPLICE FROM(IN) TO(OUT) ON(81,8,CH)         -             
  WITHALL WITH(1,80) KEEPNODUPS KEEPBASE USING(CTL1)       
//CTL1CNTL DD *                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),       
        IFTHEN=(WHEN=(1,3,SS,EQ,C'AAA,ARK'),               
       OVERLAY=(81:SEQNUM,8,ZD,1,3)),                       
        IFTHEN=(WHEN=NONE,                                 
       OVERLAY=(89:SEQNUM,8,ZD,                             
                81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))       
                                                           
                                                           
  SORT FIELDS=COPY                                         
  OUTFIL FNAMES=OUT,REMOVECC,BUILD=(01,80),                 
  INCLUDE=(89,3,CH,EQ,C'ARK'),                             
  SECTIONS=(81,8,                                           
  HEADER3=(80C'A'),                                         
  TRAILER3=(80C'A'))                                       
/*                                                         


The output from this job is

Code:

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
ARK  -PICK01                       
A    -PICK02                       
A    -PICK03                       
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
ARK -PICK04                         
A   -PICK05                         
A   -PICK06                         
A   -PICK07                         
A   -PICK08                         
A   -PICK09                         
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA


Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Sep 02, 2008 6:31 pm    Post subject: Reply with quote

You can do this kind of thing more easily and efficiently with the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  OMIT COND=(1,3,CH,EQ,C'AAA')
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,1,CH,NE,C' '),
    PUSH=(81:1,3,84:ID=8))
  OUTFIL REMOVECC,
    INCLUDE=(81,3,CH,EQ,C'ARK'),
    BUILD=(1,80),
    SECTIONS=(84,8,
      HEADER3=(80C'A'),
      TRAILER3=(80C'A'))
/*


For complete details on the WHEN=GROUP function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group