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 

DFSORT 'FIELDS=' to have dynamic position and length

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


Joined: 12 Feb 2019
Posts: 3
Topics: 1

PostPosted: Wed Feb 13, 2019 6:46 pm    Post subject: DFSORT 'FIELDS=' to have dynamic position and length Reply with quote

Hi,
This is my first post here. I have tried my best to follow the norms here. My apologies for any variations. Please let me know.

I have an input file as follows.
Column 2 - 4 - 3 digit number which is position of a string in the same record
Column 6 - 8 - 3 digit number which is length of the string in the same record

Is it possible to read the string of mentioned length from the position using SORT?

Originally this requirement coming from SMF records. But I have a simplified version of input file given below. Any help is much appreciated.
Code:

//SORTIN   DD *                                                       
*---+----10---+----20---+----30---+----40---+----50---+----60---+----70
 x015 005xxxxxxAPPLE 1 2018/08/15                                       
 x030 006xxxxxxxxxxxxxxxxxxxxxBANANA 3 2018/07/14                       
 x025 005xxxxxxxxxxxxxxxxMANGO 3 2018/07/14                             
 x010 009xPINEAPPLE 3 2018/07/14                                       
/*



Output expected is
Code:

----+----+----+
APPLE
BANANA
MANGO
PINEAPPLE

Thank You so much for your time.


Kind regards,
Sebin
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Feb 13, 2019 9:13 pm    Post subject: Reply with quote

zebs,

Welcome to mvsforums. I just added code tags to your posts that the data is more readable and retains the spacing. Check this link which explains in detail about using code tags

https://www.mvsforums.com/helpboards/viewtopic.php?p=19031#19031

Now coming to your problem I can show you way to get the desired results. But then I saw this

zebs wrote:
Originally this requirement coming from SMF records.


so I am guessing that you are planning to extract the triplets data based on offset in one of the field. You can still do that but would require generating dynamic control cards and has a limitation of how many control cards you can generate.

To give you an idea, here is JCL which will give you the desired results.
Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD *                                             
X015 005XXXXXXAPPLE 1 2018/08/15                             
X030 006XXXXXXXXXXXXXXXXXXXXXBANANA 3 2018/07/14             
X025 005XXXXXXXXXXXXXXXXMANGO 3 2018/07/14                   
X010 009XPINEAPPLE 3 2018/07/14                             
X015 004XXXXXXZEBS  1 2018/08/15                             
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                             
  SORT FROM(IN) USING(CTL1)                                 
  COPY FROM(IN) USING(CTL2)                                 
//CTL1CNTL DD *                                                     
  SORT FIELDS=(2,3,ZD,A)                                           
  SUM FIELDS=NONE                                                   
  OUTFIL FNAMES=CTL2CNTL,ENDREC=999,REMOVECC,                       
          BUILD=(09:C'IFTHEN=(WHEN=(2,3,ZD,EQ,',2,3,C'),',/,       
                 10:C'BUILD=(',2,3,C',',6,3,C')),',                 
                 80:X),                                             
        HEADER1=(03:'OPTION COPY',/,                               
                 03:'INREC IFTHEN=(WHEN=(1,1,BI,NE,1,1,BI),',/,     
                 03:'       BUILD=(1,1)),'),                       
       TRAILER1=(03:'      IFTHEN=(WHEN=(1,1,BI,NE,1,1,BI),',/,     
                 03:'       BUILD=(1,1))',/,                       
                 03:'OUTFIL FNAMES=OUT')                           
/*                                                                 
//CTL2CNTL DD DSN=&&C2,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)   
//*


The output from this job would be

Code:

APPLE       
BANANA     
MANGO       
PINEAPPLE   
ZEBS       


You can look at DFSMSG dd in the sysout and can see the generated dynamic control cards

search for ICE200I message( 2nd message) which shows IDENTIFIER FROM CALLING PROGRAM IS 0002

PS: Generating the dynamic control cards for SMF records is bit more complicated as you need to consider the RDW and build values dynamically.

Btw what type of SMF records are planning to implement this? SMF 30 or SMF 42 ?
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
zebs
Beginner


Joined: 12 Feb 2019
Posts: 3
Topics: 1

PostPosted: Wed Feb 13, 2019 10:56 pm    Post subject: Reply with quote

Hi Kolusu,

Thanks a lot for your reply. I will use the code tags for going forward.

It worked well at my end. I would like to reserve the idea of limiting the number of control cards and handling it using multiple steps as a last resort.

I am trying to extract triplets data based on offset from SMF 70 for this round.

I was considering a small routine at E61, to manipulate the control card. But I couldn't figure out anything to deal with OUTREC, using E61. Probably will need to handle entire INREC using an E15. Any suggestions or samples on that side will be a big hand.

I haven't come this far with SORT previously. So if it sounds silly, sorry about it.

Thanks,
Sebin
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Feb 14, 2019 12:26 pm    Post subject: Reply with quote

zebs wrote:

I was considering a small routine at E61, to manipulate the control card. But I couldn't figure out anything to deal with OUTREC, using E61. Probably will need to handle entire INREC using an E15. Any suggestions or samples on that side will be a big hand.


zebs,

Not sure why you want to use an E61, as E61 exit is used to lengthen, shorten, or alter any control field within a record.

The control fields are specified in SORT/MERGE statement. Your extract is done using INREC/OUTREC or OUTFIL. Do you plan to sort/merge the triplet data? Ideally I would first COPY the desired contents and verify the contents before I SORT/MERGE them.

zebs wrote:

I am trying to extract triplets data based on offset from SMF 70 for this round.


RMF has it's own reports that it can generate from the SMF data. Did you check z/OS RMF Report Analysis manual?

https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3sc342665?OpenDocument
zebs wrote:

I haven't come this far with SORT previously. So if it sounds silly, sorry about it.


No worries at all.
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
zebs
Beginner


Joined: 12 Feb 2019
Posts: 3
Topics: 1

PostPosted: Thu Feb 14, 2019 11:48 pm    Post subject: Reply with quote

Hi Kolusu,

Thanks for your help. I will look at the RMF manual. E61 was a wrong choice. I got some samples for E15 and trying to modify it the way I wanted, to handle the dynamic portion of the task. Hopefully that will solve my problem.

Thanks & Cheers,
Sebin Smile
Back to top
View user's profile Send private message
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