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 

Need to pass month part to next step

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


Joined: 07 Jan 2003
Posts: 32
Topics: 10

PostPosted: Thu Jan 19, 2006 5:42 am    Post subject: Need to pass month part to next step Reply with quote

Need help,

I have file, which I sorted and pickedup the records I wanted, and outreced the field I wanted to.
the output field contains a date field, I need to get just month part of it can I do it in one sort step. I have used:-
Code:


//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=test.input.file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD *
//SYSIN DD *
 SORT FIELDS=(5,2,CH,A,15,2,CH,A)
 INCLUDE COND=((5,2,CH,EQ,C'BC'),AND,(15,2,CH,EQ,C'DC'))
 OUTREC FIELDS=(32,4,PD,EDIT=(TTTTTT))
 SUM FIELDS=NONE

output is
060117,

What I need to see is just 01 month

Also can I pass this value as a condition to next sort step


ex., include cond=(1,2,ch,eg,c'xx')

where xx=01.
Thanks
naren
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Jan 19, 2006 6:57 am    Post subject: Reply with quote

Naren,

Quote:

What I need to see is just 01 month


You can do this easily with the PD0 operator available in OUTREC statement. Try this code.

Code:

//SYSIN DD *
 SORT FIELDS=(5,2,CH,A,15,2,CH,A)
 INCLUDE COND=((5,2,CH,EQ,C'BC'),AND,(15,2,CH,EQ,C'DC'))
 SUM FIELDS=NONE
 OUTREC FIELDS=(33,2,PD0,EDIT=(TTTT))
/*


This is how your Packed decimal date looks like in HEX format.
Code:

3----+----4---
--------------
   - @       
40061744444444
00001C00000000
--------------


Now, When I use 33,2 in outrec, I pick up the value x'6011". PD0 then truncates the left most nibble (half byte) and right most nibble - which are '6' and '1' respectively, leaving just '01'.

Quote:

Also can I pass this value as a condition to next sort step
ex., include cond=(1,2,ch,eg,c'xx')


You can do this by using the sort card below.
Code:

//SYSIN DD *
 SORT FIELDS=(5,2,CH,A,15,2,CH,A)
 INCLUDE COND=((5,2,CH,EQ,C'BC'),AND,(15,2,CH,EQ,C'DC'))
 SUM FIELDS=NONE
 OUTREC FIELDS=(33,2,PD0,EDIT=(TTTT))
 OUTFIL OUTREC=(c'  INCLUDE COND=(1,2,CH,EQ,C''',1,2,C''')')
/*


You don't need OUTFIL OUTREC actually. But i have given so just for easy understanding.

Hope this helps,

Thanks,
Phantom
Back to top
View user's profile Send private message
naren_ab
Beginner


Joined: 07 Jan 2003
Posts: 32
Topics: 10

PostPosted: Thu Jan 19, 2006 7:08 am    Post subject: Reply with quote

Yes, that helped me, thanks Phantom.

I wrote the month to file. How can I pass this month in the file to next sort step as a condition.

Thanks
naren
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 Jan 19, 2006 8:31 am    Post subject: Reply with quote

Quote:

I wrote the month to file. How can I pass this month in the file to next sort step as a condition.

naren_ab,

Simply pass the created file to sysin

ex:

Code:

//SYSIN    DD *
 SORT FIELDS=COPY
//         DD DSN=YOUR CREATED FILE WITH INCLUDE COND,
//            DISP=SHR


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


Joined: 07 Jan 2003
Posts: 32
Topics: 10

PostPosted: Thu Jan 19, 2006 8:47 am    Post subject: Reply with quote

Thanks Kolusu and Phantom, that works, thank you both. actually I overlooked the last line in Phantom reply, my mistake.

Thanks
Back to top
View user's profile Send private message
naren_ab
Beginner


Joined: 07 Jan 2003
Posts: 32
Topics: 10

PostPosted: Thu Jan 19, 2006 11:48 am    Post subject: Reply with quote

Can I pass the packed decimal value itself instead of character, that way I can use that against a packed decimal month field on the second file in next sort step. Because the second file in the next sort step has a packed decimal month too.

Code:

//SYSIN DD *
 SORT FIELDS=(5,2,CH,A,15,2,CH,A)
 INCLUDE COND=((5,2,CH,EQ,C'BC'),AND,(15,2,CH,EQ,C'DC'))
 SUM FIELDS=NONE
 OUTREC FIELDS=(33,2)
 OUTFIL OUTREC=(c'  INCLUDE COND=(1,2,CH,EQ,C''',1,2,C''')')
/*


I tried to do some changes to the above step for the same, but I am getting INCLUDE COND=(7,2,PD,EQ,'01')
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 Jan 19, 2006 11:55 am    Post subject: Reply with quote

naren_ab,

Is the month field stored seperately ? or is it like the date field mentioned in the first post of yours?

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


Joined: 07 Jan 2003
Posts: 32
Topics: 10

PostPosted: Thu Jan 19, 2006 12:03 pm    Post subject: Reply with quote

It is date field, and I need to work on the month part of it.

naren
Back to top
View user's profile Send private message
naren_ab
Beginner


Joined: 07 Jan 2003
Posts: 32
Topics: 10

PostPosted: Thu Jan 19, 2006 12:06 pm    Post subject: Reply with quote

Kolusu,


I am getting this error. what I am missing here


in first sort step I have
OUTFIL OUTREC=(C' INCLUDE COND=(7,2,PD,EQ,',33,2,PD,EDIT(TT),C')')

output is INCLUDE COND=(7,2,PD,EQ,01)



in 2nd sort step
SYSIN :
SORT FIELDS=COPY
INCLUDE COND=(7,2,PD,EQ,01)
WER274A CONTINUATION STATEMENT ERROR FOUND
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
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 Jan 19, 2006 12:09 pm    Post subject: Reply with quote

naren_ab,

change this
Quote:

OUTFIL OUTREC=(C' INCLUDE COND=(7,2,PD,EQ,',33,2,PD,EDIT(TT),C')')


to
Quote:

OUTFIL OUTREC=(C' INCLUDE COND=(7,2,PD,EQ,',33,2,PD,EDIT(TT),C')',80:X)


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


Joined: 07 Jan 2003
Posts: 32
Topics: 10

PostPosted: Thu Jan 19, 2006 12:59 pm    Post subject: Reply with quote

Need some more help,

I got the value from previous step as 01 for January,
In the next sort step I have another file with date field, I want to get all the records from that file with same month as 01. this date field is also packed decimal field. So i am trying to
INCLUDE COND=(6,2,PD,EQ,01) but it is not working.
but it is not returning any records.

Thanks
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 Jan 19, 2006 1:10 pm    Post subject: Reply with quote

naren_ab,

Check this topic for using PD0 format to include specific records

http://www.mvsforums.com/helpboards/viewtopic.php?t=4334&highlight=pd0

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