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

New output file based on comparing a field from one file.


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

New User


Joined: 22 Mar 2010
Posts: 11
Location: india

PostPosted: Thu May 27, 2010 7:49 pm
Reply with quote

Hi,

I have a file with 4 fields, file is fixed length of 260 length.

Input File
------------
AC0000000011AA....
AC0000000011II......
AC0000000012AA......
AC0000000012II......
AC0000000013II......
AC0000000014II......
AC0000000015AA......
AC0000000016AA.....

AC- Account type
0000000011 - account number
AA -flag type.

I need to write a new with following condition

new output file contains only record with flag type II, But this record must have a record with same account number and flag type AA.

The output record should contain the following records.

Output file:
------------

AC0000000011II......
AC0000000012II......

Please advice me, how to do this using SORT.

Regards,
KDR
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu May 27, 2010 7:55 pm
Reply with quote

FB or VB ? Length of fields ?

Because the solution for sort related questions may vary from product to product, please ensure that you state clearly which sort product you are using.

If you are not sure, then by running a simple sort step shown below, you will be able to find out for yourself.

If the messages start with ICE then your product is DFSORT and will be moved to the correct forum by one of the moderators. Please also post the output of the complete line which has a message code ICE201I, as this will enable our DFSORT experts to determine which release of DFSORT that you have installed. This may also affect the solution offered.

If the messages start with WER or SYT then the product is SYNCSORT and the topic will be remain in the JCL forum. Please also post the information telling which version of SYNCSORT is installed, as this may also affect the solution offered.

Thank you for taking your time to ensure that the valuable time of others is not wasted by offering inappropriate solutions which are not relevant due to the sort product being used and/or the release that is installed in your site.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY
Back to top
View user's profile Send private message
kondru

New User


Joined: 22 Mar 2010
Posts: 11
Location: india

PostPosted: Thu May 27, 2010 8:18 pm
Reply with quote

Hi,
It is fixed block length of 260. I am using SYNCSORT. I am not sure which version it is.


AC- Account type - lenght 2
0000000011 - account number - length -20
AA -flag type - length 2

Regards,
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu May 27, 2010 8:22 pm
Reply with quote

kondru wrote:
I am using SYNCSORT. I am not sure which version it is.

If you look at the sysout from the dummy job I posted previously then you will be able to find out. The release level is important as it will affect the solutions which can be used to resolve your question.

Please run the job and post the required information.
Back to top
View user's profile Send private message
ravi_singh02

New User


Joined: 28 May 2010
Posts: 2
Location: Bangalore

PostPosted: Fri May 28, 2010 5:53 pm
Reply with quote

Hi,

Can't say with Sort but this can be done with DFSORT as you give the INCLUDE = (condition fulfilling the Requirement you can give as (20,2 eq,'AA'))
So, you can try out that way.

Thanks,
Ravi.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri May 28, 2010 6:02 pm
Reply with quote

ravi_singh02 wrote:
Can't say with Sort but this can be done with DFSORT as you give the INCLUDE = (condition fulfilling the Requirement you can give as (20,2 eq,'AA'))
Well, that was about as useful as a chocolate teapot. Please read the requirement properly before commenting.

@kondru
Can you not use SELECT to find the matching records. I know how to do it in DFSORT but unfortunately I'm not a SYNCSORT user so can't really help too much apart from giving an idea on how to do this.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri May 28, 2010 6:40 pm
Reply with quote

kondru wrote:
new output file contains only record with flag type II, But this record must have a record with same account number and flag type AA.
Seems like a fairly simple application for JOIN/JOINKEYS....
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 May 28, 2010 8:47 pm
Reply with quote

Hello,

So far, i've not JOINed a single file. . .(to itself?). Is this an option?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri May 28, 2010 9:06 pm
Reply with quote

Can't F1 and F2 be the same file?
The joinkey allows include/omit so the one file can appear as two different ones.
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
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top