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 

OUTREC

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


Joined: 11 Apr 2005
Posts: 42
Topics: 19
Location: India

PostPosted: Mon Apr 11, 2005 9:59 am    Post subject: OUTREC Reply with quote

Hello,

Following is the problem I am facing.
I have a variable length file from which I have to extract some records and create an output file of Fixed length.
Also, there is a two byte field in the input file on position 63 (considering the 4 bytes for RDW) which is in a time field HHMM (HH - Hours, MM - Minutes) format.
I need to convert this two byte field into four bytes numeric field HHMM.

Below is the SORT Card I am using:
Code:

  SORT FIELDS=COPY                                                     
  INCLUDE COND=(((77,02,BI,EQ,X'220F'),OR,                             
                 (77,02,BI,EQ,X'320F'),OR,                             
                 (77,02,BI,EQ,X'222F'),OR,                             
                 (77,02,BI,EQ,X'322F'),OR,                             
                 (77,02,BI,EQ,X'224F'),OR,                             
                 (77,02,BI,EQ,X'324F'),OR,                             
                 (77,02,BI,EQ,X'225F'),OR,                             
                 (77,02,BI,EQ,X'325F')),AND,                           
                 (83,01,BI,EQ,X'19'))                                   
  OUTFIL FNAMES=FB1,VTOF,OUTREC=(5,62,63,2,PD,TO=ZD,LENGTH=4,65,100)             

In the OUTFIL FNAMES I am converting the Variable length input file to Fixed length.
When I run this sort step, I get an output which contains the same two byte field in the HHMM format, following this field is two bytes of junk, and following it is four bytes data which looks like the numeric form of HHMM in four bytes, but still the last byte (4th byte) is junk.

Please advise on how should I accomplish this conversion of a two byte HHMM field to a four byte HHMM number field. I do not want the two byte HHMM in output again.

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


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

PostPosted: Mon Apr 11, 2005 10:12 am    Post subject: Reply with quote

Siddheart22,

what is the format of the field at pos 63 ? is it comp or comp-3? Moreover your OUTREC is copying the first 62 bytes from 5 which means you alreay included the HHMM field in your outrec as you mentioned that HHMM field is at pos 63 considering the RDW.

So change your outrec fields.

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


Joined: 11 Apr 2005
Posts: 42
Topics: 19
Location: India

PostPosted: Mon Apr 11, 2005 10:26 am    Post subject: OUTREC Reply with quote

Thanks for an impromptu response.

Also, thanks for advising on the OUTREC portion, I have corrected that and now it looks like:
OUTFIL FNAMES=FB1,VTOF,OUTREC=(5,58,63,2,PD,TO=ZD,LENGTH=4,65,100)

And the output is now, the HHMM field in four bytes, I would cut paste a sample of the output record (with HEX ON) for your reference:

[code:1:986f774200]
3----+----4----+----5----+----6----+----7
..................%NE113-.r.*017
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: Mon Apr 11, 2005 10:34 am    Post subject: Reply with quote

The problem is that X'1724' is not a valid PD value since the 4 is treated as a sign. You can convert your 2-byte value to a 3-byte PD value multiplied by 10 by adding X'0C' after the 2-byte value. Then you can divide by 10 to get 'hhmm'.

Here's a DFSORT job that will do what you want:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  VB input
//FB1 DD DSN=...  FB output
//SYSIN    DD    *
 OPTION COPY
* Convert X'hhmm' to X'hhmm0C'.
 INREC FIELDS=(1,62,63:63,2,X'0C',66:65)
* Convert X'hhmm0C' to C'hhmm'.
 OUTFIL FNAMES=FB1,VTOF,
   OUTREC=(5,58,63,3,PD,DIV,+10,TO=ZD,LENGTH=4,66,100)
/*

_________________
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
Siddheart22
Beginner


Joined: 11 Apr 2005
Posts: 42
Topics: 19
Location: India

PostPosted: Mon Apr 11, 2005 11:02 am    Post subject: OUTREC Reply with quote

Firstly I should pay my gratitude for having this interface where one can not just get his/her queries resolved, but your elaborate answers helps one understand really well. Should say its an excellent portal for Query Resolution and Learning Center!

Coming back to this query,
I tried your sort card and it works.
But, since, the output field I am expecting should be HHMM all numberic (like 9(04)) but for X'1724' field the output is coming as X'F1F7F2C4' now this C4 causes the output to look as 172D whereas expected is 1724.

How do I get the desired results?

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


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

PostPosted: Mon Apr 11, 2005 11:16 am    Post subject: Reply with quote

Siddheart22,

You can use EDIT masks to get the desired results. try this

Code:

  OUTFIL FNAMES=FB1,VTOF,
  OUTREC=(5,58,63,3,PD,DIV,+10,EDIT=(TTTT),66,100)


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


Joined: 11 Apr 2005
Posts: 42
Topics: 19
Location: India

PostPosted: Mon Apr 11, 2005 11:29 am    Post subject: OUTREC Reply with quote

It WORKED!!!

Kudos to MVSFORUMS team!!

I was really struggling with this problem, and now am very delighted with your quick solution!

Thanks for making my day!
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: Mon Apr 11, 2005 2:15 pm    Post subject: Reply with quote

Quote:
But, since, the output field I am expecting should be HHMM all numberic (like 9(04)) but for X'1724' field the output is coming as X'F1F7F2C4' now this C4 causes the output to look as 172D whereas expected is 1724.


If that's the case then you're using Syncsort, not DFSORT. Syncsort sets a C sign for TO=ZD conversion. DFSORT sets an F sign. If you were using DFSORT, my job with TO=ZD would give you what you want. With Syncsort, it doesn't. Of course, as Kolusu pointed out EDIT=(TTTT) will also do what you want for both DFSORT and Syncsort. So will M11,LENGTH=4.
_________________
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