IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

sorting two different positional fields of a VB with OUTREC


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ram_vizag

Active User


Joined: 21 Aug 2008
Posts: 112
Location: hyd

PostPosted: Thu Apr 04, 2013 9:17 pm
Reply with quote

Hi,

I have a file with 1220(VB). i have to copy the data from positions and length respectively being at (4,22) and (1124,08) into the out put file

I have coded and the output like this:

[SORT FIELDS=(4,19,CH,A,1124,08,CH,A)
OUTREC FIELDS=(1,25,1128,08)
]

output:
[
13000037787611000026000228135
13000037787611000027800228135
13000037787611000091401475741
13000037787611000092201475741
]

but what i expect is

[00037787611000026000228135
00037787611000027800228135
00037787611000091401475741
]

please some one help
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Thu Apr 04, 2013 9:27 pm
Reply with quote

I assume that you have already considered that the VB records consist of a 4-byte RDW followed by the data.

Can you post your sample input data and expected Output data(using Code Tags).

Edited:
Also please specify if you are using Syncsort/DFSORT??
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 04, 2013 11:20 pm
Reply with quote

ram_vizag,

I know you know how to use the Code tags, so please remember to do so.

Post the full sysout, including the message numbers, please.

As mistah kurtz has noticed, your positions are wrong for a VB, but there might be other problems as well.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Apr 05, 2013 1:39 am
Reply with quote

Hello,

I'm probably missing something, but as the code has no include/omit/sum/etc processing, why is there a different number of records expected? Why is one gone from your "expected" output?
Back to top
View user's profile Send private message
ram_vizag

Active User


Joined: 21 Aug 2008
Posts: 112
Location: hyd

PostPosted: Fri Apr 05, 2013 12:14 pm
Reply with quote

input data:

Code:

130000377876112719222 1    20130207AXGGQM   00000000520160630
130000377876112719230 1    20130207AXGGQM   00000000520160731
130000377876114175183 1    20130207AXGGQV   00000000520160331
130000377876114175209 1    20130207AXGGQV   00000000520160531
130000377876199500248 1    20050923ASSSTD B020081103820101231


expected :
Code:

000377876112719222
000377876112719230
000377876114175183
000377876114175209
000377876199500248
000377876401200579

afterthe above 19 bytes , another 8 bytes are to be written from position (1124,8)... i think u got now...record length is 1220 with Vb and need to sort (positions,length) --->(4,22) and (1124,8)
Back to top
View user's profile Send private message
ram_vizag

Active User


Joined: 21 Aug 2008
Posts: 112
Location: hyd

PostPosted: Fri Apr 05, 2013 12:15 pm
Reply with quote

i need only these two fields (4,22) and( 1124,8) into outrec...please help
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Apr 05, 2013 12:28 pm
Reply with quote

Now you've got more data in the output than the input.

From your data it is unclear if it is already sorted (it looks like it is) or whether you want to SORT.

Do you want the output as a VB or FB?

Is your 2nd field with the minimum length of the VB?

It is a really simple thing, what is the problem you are having?

Where are the messages I asked for?
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 63
Location: pune

PostPosted: Fri Apr 05, 2013 12:28 pm
Reply with quote

Hi Ram,

Do you want to copy data from VB file to VB file or VB file to FB file ?
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 63
Location: pune

PostPosted: Fri Apr 05, 2013 12:50 pm
Reply with quote

Hi Ram,

Please find the code for VB to FB -

Code:
//SYSIN    DD *                               
   SORT FIELDS=(4,19,CH,A,1124,08,CH,A)       
   OUTFIL FNAMES=SORTOUT,VTOF,               
   OUTREC=(08,22,1128,8,1220:X),VLFILL=C' '   
//*                                           




for VB to VB -
Code:
//SYSIN    DD *                                 
   SORT FIELDS=(4,19,CH,A,1124,08,CH,A)         
   OUTFIL FNAMES=SORTOUT,VLFILL=C' ',VLTRIM=C' ',
   OUTREC=(01:01,04,05:08,22,28:1128,8)         
//*                                             
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Apr 05, 2013 1:06 pm
Reply with quote

I'm not sure if we're a bit fast to jump to a solution; also I'm confused with the sample data posted so far. First you had less number of records in output and later you've got more data in the output than the input, as Bill has also questioned. icon_neutral.gif

If this is
Quote:
i need only these two fields (4,22) and( 1124,8) into outrec
what you only need, and you're just sorting on those positions - why the number of records in input and output are not same, as Dick said?
Back to top
View user's profile Send private message
ram_vizag

Active User


Joined: 21 Aug 2008
Posts: 112
Location: hyd

PostPosted: Fri Apr 05, 2013 1:51 pm
Reply with quote

Thanks sandip_mainframe... ur code helped me...

anuj Dhawan/bill

As can't copy all the 1220 bytes of data ...i gave the above data just for ur understanding...anyways thanks...

I understood the concept now...
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Apr 05, 2013 1:57 pm
Reply with quote

ram_vizag,

If you answer the questions we can put you right. I'm not sure how the code shown so far helps you, as it is somewhat "unusual".

sandip_mainframe,

I appreciate your enthusiasm, but I'm not sure what you are trying to do.
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 63
Location: pune

PostPosted: Fri Apr 05, 2013 2:13 pm
Reply with quote

Hi Bill,

I am sorry, I was bit fast to answer, without getting correct requirement, I had provided solution. I apologize for this. Going forward I will keep this in mind.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
No new posts question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts Sorting a record spanned over multipl... DFSORT/ICETOOL 13
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
Search our Forums:

Back to Top