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 

To extract fields from different records
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
anita_m
Beginner


Joined: 20 Sep 2006
Posts: 41
Topics: 12
Location: Venus

PostPosted: Thu Sep 28, 2006 2:15 am    Post subject: To extract fields from different records Reply with quote

In a file, if a record has xxx in 3rd byte, then I want to skip next 2 records and extract yyy from 8th byte of the record.

bytes -> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 . . . .
1 -> x x x
2 ->
3 ->
4 -> y y y


I can only use usaul sort and not use dfsort, icetool etc. I do not have access to IBM website Smile
Back to top
View user's profile Send private message
anita_m
Beginner


Joined: 20 Sep 2006
Posts: 41
Topics: 12
Location: Venus

PostPosted: Thu Sep 28, 2006 2:21 am    Post subject: Reply with quote

Just to clarify the example

bytes -> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 . . . .
1 -> ----------x x x-------------------------------------
2 -> ----------------------------------------------------
3 -> ----------------------------------------------------
4 ->-----------------------y y y--------------------------
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Thu Sep 28, 2006 3:21 am    Post subject: Reply with quote

anita_m,

Please post the question in correct topics and be more clear in you question .

Is it that if in a record 3-5 bytes are 'XXX' then you need to skip two next records and include the fields from POS 8-10 which have 'YYY' to your output ?
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
anita_m
Beginner


Joined: 20 Sep 2006
Posts: 41
Topics: 12
Location: Venus

PostPosted: Thu Sep 28, 2006 4:25 am    Post subject: Reply with quote

Yes. I want yyy in bytes 8-10 of record 4 in output rec if a rec in input file has xxx in bytes 3-5 of record 1
Back to top
View user's profile Send private message
anita_m
Beginner


Joined: 20 Sep 2006
Posts: 41
Topics: 12
Location: Venus

PostPosted: Thu Sep 28, 2006 4:32 am    Post subject: Reply with quote

another eg.
If i/p is
Code:

aaaaaaaaaaaxxxaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaxxxaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaayyyaaaaaaaaa
aaaaaaaaaaaxxxaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaxxxaaaaaaaauuuaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaazzzaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaavvvaaaaaaaaa

o/p should be
Code:

yyy
uuu
zzz
vvv
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: Thu Sep 28, 2006 8:55 am    Post subject: Reply with quote

anita_m,

Assuming that you don't have a XXX record in before you pick the 3rd record, the following DFSORT/ICETOOL JCL will give you the desired results. If for some reason you cannot use this sort then you need to write a program to get the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL                           
//TOOLMSG   DD SYSOUT=*                               
//DFSMSG    DD SYSOUT=*                               
//IN        DD *                                       
  XXX                                                 
                                                       
                                                       
       YYY                                             
  XXX                                                 
                                                       
                                                       
       UUU                                             
  XXX                                                 
                                                       
                                                       
       VVV                                             
  XXX                                                 
                                                       
                                                       
       ZZZ                                             
//OUT       DD SYSOUT=*                               
//TOOLIN    DD *                                       
  SPLICE FROM(IN) TO(OUT) WITHEACH -                   
      ON(321,8,CH)                 -                   
    WITH(081,80)                   -                   
    WITH(161,80)                   -                   
    WITH(241,80)                   -                   
  KEEPNODUPS USING(CTL1)                               
//CTL1CNTL  DD *                                             
  INREC IFTHEN=(WHEN=INIT,                                   
       OVERLAY=(001:01,80,                                   
                081:01,80,                                   
                161:01,80,                                   
                241:01,80,                                   
                321:SEQNUM,8,ZD,START=4,INCR=1,               
                329:321,8,ZD,MOD,+4,TO=ZD,LENGTH=1),HIT=NEXT),
                                                             
        IFTHEN=(WHEN=(329,1,ZD,EQ,0),                         
       OVERLAY=(081:240X)),                                   
                                                             
        IFTHEN=(WHEN=(329,1,ZD,EQ,1),                         
       OVERLAY=(001:080X,                                     
                161:160X,                                     
                321:321,8,ZD,SUB,329,1,ZD,M11,LENGTH=8)),     
                                                             
        IFTHEN=(WHEN=(329,1,ZD,EQ,2),                         
       OVERLAY=(001:160X,                                     
                241:080X,                                     
                321:321,8,ZD,SUB,329,1,ZD,M11,LENGTH=8)),     
                                                             
        IFTHEN=(WHEN=(329,1,ZD,EQ,3),                         
       OVERLAY=(001:240X,                                     
                321:321,8,ZD,SUB,329,1,ZD,M11,LENGTH=8))     
                                                             
   OUTFIL FNAMES=OUT,INCLUDE=(3,3,CH,EQ,C'XXX'),             
   OUTREC=(248,003)                                           
/*                                                           


Hope this helps...

Cheers

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


Joined: 20 Sep 2006
Posts: 41
Topics: 12
Location: Venus

PostPosted: Fri Sep 29, 2006 12:24 am    Post subject: Reply with quote

I told you I cant use dfsort!!
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 Sep 29, 2006 7:27 am    Post subject: Reply with quote

anita_m wrote:

I told you I cant use dfsort!!


anita_m,

I guess you missed this statement in my post

kolusu wrote:

If for some reason you cannot use this sort then you need to write a program to get the desired results.


If easytrieve is an option then the following pgm will give you the desired results. This also takes care of multiple XXX records.

Code:

//STEP0100 EXEC PGM=EZTPA00                   
//STEPLIB  DD DSN=EASYTREV.LOADLIB,
//            DISP=SHR                       
//SYSPRINT DD SYSOUT=*                       
//SYSOUT   DD SYSOUT=*                       
//SYSSNAP  DD SYSOUT=*                       
//SYSUDUMP DD SYSOUT=*                       
//INFILE   DD *                               
  XXX                                         
                                             
  XXX                                         
       YYY                                   
  XXX                                         
  XXX  UUU                                   
                                             
       ZZZ                                   
       VVV                                   
//OUTFILE  DD SYSOUT=*,LRECL=80,RECFM=FB     
//SYSIN    DD *                               
                                                   
  FILE INFILE                                       
       IN-IND           03 03 A                     
       PICK-IND         08 03 A                     
                                                   
  FILE OUTFILE                                     
       OUT-IND          01 03 A                     
                                                   
  W-PICK-REC1       W   08 N 0                     
  W-PICK-REC2       W   08 N 0                     
                                                   
  JOB INPUT INFILE                                 
                                                   
      IF IN-IND      = 'XXX'                       
         IF RECORD-COUNT < W-PICK-REC1             
            IF RECORD-COUNT = W-PICK-REC2           
               PERFORM WRITE-OUTPUT                 
               W-PICK-REC2  = 0                     
            END-IF                                 
            W-PICK-REC2  = RECORD-COUNT + 3         
         ELSE                                       
            W-PICK-REC1  = RECORD-COUNT + 3         
         END-IF                                     
      END-IF                                       
                                                   
      IF RECORD-COUNT = W-PICK-REC1                 
         PERFORM WRITE-OUTPUT                       
         W-PICK-REC1  = 0                           
      END-IF                                       
                                                   
      IF RECORD-COUNT = W-PICK-REC2                 
         PERFORM WRITE-OUTPUT                       
         W-PICK-REC2  = 0                           
      END-IF                                       
                                                   
 WRITE-OUTPUT. PROC                   
                                     
         OUT-IND      = PICK-IND     
         PUT OUTFILE                 
                                     
 END-PROC                             
/*                                   


Hope this helps...

Cheers

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


Joined: 20 Sep 2006
Posts: 41
Topics: 12
Location: Venus

PostPosted: Wed Apr 18, 2007 1:07 pm    Post subject: Reply with quote

Yes it helped! Thanks
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Wed Apr 18, 2007 1:36 pm    Post subject: Reply with quote

anita_m,

Quote:
I can only use usaul sort and not use dfsort, icetool etc. I do not have access to IBM website


This statement makes no sense. What do you mean by "usual sort"? DFSORT, Syncsort and CA-SORT are the three main z/OS sort products. None of them is the "usual sort". Whichever product your site has a license for is the sort product used at your site. And why wouldn't you have access to the IBM website ... if you can get to the web, which you obviously can since you're posting here, then you can access the IBM website.

Quote:
I told you I cant use dfsort!!


Wow. Kolusu goes out of his way to help you and you chastise him because he couldn't understand your statement that didn't make any sense. Keep that kind of thing up and nobody here is going to be willing to help you.
_________________
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
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Thu Apr 19, 2007 3:54 am    Post subject: Reply with quote

Quote:

I told you I cant use dfsort!!


In Venus this may mean
Quote:
Thanks. Unfortunately I can't use dfsort and I only have the "usual SORT"
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Thu Apr 19, 2007 5:06 am    Post subject: Reply with quote

If you read carefully - it is USAUL sort - not USUAL. Now, that may be a typo but maybe there is a USAUL sort product out there - albeit on Venus or elsewhere. However, there is the possibility that she means EXEC PGM=SORT not realising that SORT is actually DFSORT (or another flavour).

Actually, I am quite partial to Venusians Laughing
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Thu Apr 19, 2007 5:26 am    Post subject: Reply with quote

What message prefixes does usual sort give out ?

ICE
WER

Quote:
Actually, I am quite partial to Venusians

Is that legal Laughing
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Thu Apr 19, 2007 5:52 am    Post subject: Reply with quote

[
Quote:
Is that legal Laughing


Only if they have both arms and are not made of stone
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
anita_m
Beginner


Joined: 20 Sep 2006
Posts: 41
Topics: 12
Location: Venus

PostPosted: Wed Apr 25, 2007 6:02 pm    Post subject: Reply with quote

Frank,

Quote:
Kolusu goes out of his way to help you and you chastise him because he couldn't understand your statement that didn't make any sense.


Chastise! Shocked Are you kidding me?! I admire him like hell! Well...looks like that statement comes across as rude but actually I had made it casually. I was just feeling bad that he had to spend time on writing up a solution that I wouldnt be able to use. I guess my query didnot make much sense but I know 'cant use ICETOOL' part of it was clear.

Quote:
Keep that kind of thing up and nobody here is going to be willing to help you.


Will definitely take care of my tone in future.........................................or will just get another id! Laughing

Quote:
why wouldn't you have access to the IBM website ...


The only website that we can access from office is mvsforums, everything else is blocked.

Quote:
This statement makes no sense. What do you mean by "usual sort"?


Sorry for my crude vocab and the typo Embarassed , I had meant Syncsort

Quote:
However, there is the possibility that she means EXEC PGM=SORT not realising that SORT is actually DFSORT (or another flavour).


Yes Nic, thats what it was 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 -> Job Control Language(JCL) All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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