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 

Extract record based on packed decimal format

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


Joined: 12 Jun 2007
Posts: 22
Topics: 6

PostPosted: Fri Aug 03, 2007 1:57 pm    Post subject: Extract record based on packed decimal format Reply with quote

hi,
I have a requirment, i need to extract record form the production file.
I have been given the key of the record to be extacted in charter format .
They want me to do it thru file aid(As only few records).

I want to do it in sort.
The problem is the key fields are in packed decimal format in
production and i have it in char format.
i was trying to use joinkeys and because the length does not match it was
giving me error .

the position of key in production Start postion 7 leng 5, start ps 12 leng 4
the input key i have is like following 1st key 020070730 2nd key 4000017


Can any on provide me a solution for this.
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Fri Aug 03, 2007 3:25 pm    Post subject: Reply with quote

Could you please post some samples of the production file and of the keys of the records to be extracted?
Back to top
View user's profile Send private message
Aswin
Beginner


Joined: 12 Jun 2007
Posts: 22
Topics: 6

PostPosted: Fri Aug 03, 2007 3:51 pm    Post subject: Reply with quote

Quote:

Could you please post some samples of the production file and of the keys of the records to be extracted?

I dint get what you exactly you want.
The record is too huge 1800 byte Fb.
and the key is in packed decimal format as i told you.
its basicaly a date followed by serial number

My doubt is how can I compare the packed decimal format key to that of a char format.

hope I am clear now
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Aug 03, 2007 4:45 pm    Post subject: Reply with quote

Aswin,

Even though your input is packed , it does not matter you can use an INCLUDE statement in character format and extract the data

try this sort statement

Code:

//SYSIN     DD *
  INCLUDE COND=(07,5,PD,EQ,20070730,AND,
                12,4,PD,EQ,4000017)
   SORT FIELDS=COPY
/*


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


Joined: 12 Jun 2007
Posts: 22
Topics: 6

PostPosted: Fri Aug 03, 2007 6:31 pm    Post subject: Reply with quote

Yes you are right.
My input is also a file so I am using join keys
Code:

//STEP40   EXEC  PGM=SORT                                           
//SORTJNF1 DD *                                                     
0200707304000017       (would be file inturn)                                           
//SORTJNF2 DD DSN=PMSG.RGWB131.STIFOUT.EARLY.BKUP(-3),DISP=SHR       
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD  *                                                     
 JOINKEYS FILE=F1,FIELDS=(1,5,A,6,4,A) how do i code this                               
 JOINKEYS FILE=F2,FIELDS=(7,5,A,12,4,A)                             
 REFORMAT FIELDS=(F2:1,1008)                                         
 SORT FIELDS=COPY                                                   
/*                                                                   
//SYSOUT   DD  SYSOUT=X                                             
//SYSPRINT DD  SYSOUT=X                                             


how do i code join key for first file
JOINKEYS FILE=F1,FIELDS=(1,5,A,6,4,A)
JOINKEYS FILE=F1,FIELDS=(1,9,A,10,7,A) first 9 is date ad rest 7 are serial no.

but in my production file the same data is stored in comp3 packed decimal format.
so the joinkeys
JOINKEYS FILE=F2,FIELDS=(7,5,A,12,4,A)
9(9) comp3 5bytes and 9(7) comp3 4 bytes

hope this explains what the problem is.
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Fri Aug 03, 2007 6:40 pm    Post subject: Reply with quote

Have fun kolusu, he "dint get what you exactly" what I wanted..... bonk
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Sat Aug 04, 2007 7:35 am    Post subject: Reply with quote

Aswin,

why do you need a JOIN operator for such a simple include job? you just need symbols statements and then you can use them in the next step. Here try this . The first step creates 2 symbols from the file with the character data. The next step uses these 2 values and extracts the desired records.


Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT    DD SYSOUT=*                                   
//SORTIN    DD *                                         
0200707304000017                                         
//SORTOUT   DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN     DD *                                         
  OPTION STOPAFT=1                                       
  SORT FIELDS=COPY                                       
  OUTFIL OUTREC=(C'VAL1,',01,9,/,                         
                 C'VAL2,',10,7,80:X)                     
/*                                                       
//STEP0200 EXEC PGM=SORT
//SYSOUT    DD SYSOUT=*                   
//SYMNAMES  DD DSN=&T1,
//             DISP=SHR           
//SORTIN    DD DSN=your input file,
//             DISP=SHR                         
//SORTOUT   DD DSN=your output file,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//SYSIN     DD *                         
  INCLUDE COND=(07,5,PD,EQ,VAL1,AND,   
                12,4,PD,EQ,VAL2)       
  SORT FIELDS=COPY
/*                 


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


Joined: 12 Jun 2007
Posts: 22
Topics: 6

PostPosted: Mon Aug 06, 2007 5:15 pm    Post subject: Reply with quote

Thanks a lot kolusu Very Happy
it solved my problem
I would like to know wht does the first step do .
Does it changes char format to hexa?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Aug 07, 2007 8:16 am    Post subject: Reply with quote

Quote:

I would like to know wht does the first step do .
Does it changes char format to hexa?


Aswin,

NO. The first step only creates a symbols which are used in the next step. The output from step1 will be as follows
Code:

val1,20070730
val2,4000017


now in step2 the values of val1 and val2 will be substituted and it will select the desired records.

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
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