View previous topic :: View next topic
|
Author |
Message |
Amit S
New User
Joined: 30 Jul 2010 Posts: 17 Location: india
|
|
|
|
Hello All,
I have 2 input PS files as below
File1
-----
Code: |
First_name Last_name State
------------- --------------------- ------
Raj Shhhh FX
Tuz ddd FX
Ryan tttttt ML
Reg eeeeeeeee PN |
File2
-----
Code: |
State city area
-------------------------------
FX abc pqr
ML ddd iii
FX XYZ rdt
ML hhh uuu
PN rrr eee |
I am trying to code a cobol program whose output file will be like this
Output file
-----------
Code: |
First_name Last_name State City Area
------------- --------------------- ------ ---- ------
Raj Shhhh FX abc pqr
Tuz ddd FX abc pqr
Raj Shhhhh FX XYZ rdt
Tuz ddd FX XYZ rdt
Ryan tttttt ML ddd iii
Ryan tttttt ML hhh uuu |
I also searched in existing forum for any similar type of program but did not find any.
Please let me know at earliest if any one have code for this.
Thank you, |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Sorry to be so slow, but yes, people will have code for this.
When posting your data, please include it within the Code tags, as this will preserve spacing.
What state are you talking about which only has one city? Usually states have lots of cities, towns, etc.
If the requirment is as simple as you make out, solutions will be available using your sort product.
If you've found the two-file match program at the top of the Cobol forum, and follow the advice in the topic you tailgated, then that will give you something. |
|
Back to top |
|
|
Amit S
New User
Joined: 30 Jul 2010 Posts: 17 Location: india
|
|
|
|
Akatsukami,
Thank you for the link. I was out of COBOL coding activities for quite few years and so I was not very active in this forum. So its kind of new for me
Thanks, |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
if that is all You have to do <sort> might be the fastest way around
quite a lots of examples, search for JOINKEYS |
|
Back to top |
|
|
Amit S
New User
Joined: 30 Jul 2010 Posts: 17 Location: india
|
|
|
|
Thank you Enrico, let me check joins related topics too |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
When posting data, code, jcl, screen info, and etc, you need to use the "Code" tag to improve readability and alignment. I tried to Code your data, but you had already tried to align in the Reply Editor (which destroys the alignment). |
|
Back to top |
|
|
Amit S
New User
Joined: 30 Jul 2010 Posts: 17 Location: india
|
|
|
|
Thank you D.Sch. Thats realy a more precise way of posting. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
maybe I'm missing something, why isn't state PN also a match in output file ?
Gerry |
|
Back to top |
|
|
Amit S
New User
Joined: 30 Jul 2010 Posts: 17 Location: india
|
|
|
|
attachment deleted, a useless waste of space. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Yup, attachments are most often not a good thing. . .
What about the question Gerry asked?
Quote: |
maybe I'm missing something, why isn't state PN also a match in output file ? |
|
|
Back to top |
|
|
Amit S
New User
Joined: 30 Jul 2010 Posts: 17 Location: india
|
|
|
|
Hello All,
Is is possible to achieve the same merge function using ICETOOL only? my JCL is working fine in mainframe for the above code but in UNIX it is giving parsing error : syntax error at ","
Thanks, |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
You are quite close to having your topic locked and probably getting a Warning.
You still have not answered Gerry's question (which is just rude) and now present this question about ICETOOL and UNIX .
You posted a COBOL question (or so we understood) so how does ICETOOL even relate. . .
d |
|
Back to top |
|
|
Amit S
New User
Joined: 30 Jul 2010 Posts: 17 Location: india
|
|
|
|
Sorry , I missed Gary's post. Gary is right. PN will also be a match in last rows starting with Reg in first field.
I missed to post that row in output file.
I started this thread with a COBOL code in mind but my goal was achieved with JOINKEYS in SORT utility to get a desired output file. I am just checking if the output file with same format can be generated using ICETOOL/ICEMAN.
Thanks, |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Perhaps if you can confirm which Sort product you are using and full details of the problem you are having, including the Unix bit (which Unix, etc), the topic can be moved/split into the appropriate forum. Full sort code, full messages, sample input/required output, all in the Code tags.
Take the time to get it all right. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
I have been called many other names before but Gary is not one of them.
Gerry |
|
Back to top |
|
|
Amit S
New User
Joined: 30 Jul 2010 Posts: 17 Location: india
|
|
|
|
Hi Gerry,
I am sorry, I mispelled.
Thanks, |
|
Back to top |
|
|
Amit S
New User
Joined: 30 Jul 2010 Posts: 17 Location: india
|
|
|
|
Hi Bill,
Please find the details below:
Server where code is failing:
SunOS 5.10.
Full Sort Code
---------------
Code: |
//JOIN01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=FILE1,DISP=SHR
//SORTJNF2 DD DSN=FILE2,DISP=SHR
//SORTOUT DD DSN=MERGED FILE,DISP=OLD
//*********************************************
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(19,2,A)
JOINKEYS FILES=F2,FIELDS=(1,2,A)
REFORMAT FIELDS=(F1:1,5,F1:7,10,F1:19,4,F2:1,3,F2:6,5,F2:12,4)
SORT FIELDS=COPY
//
%%%%%%%%%%%%%%%%%%%%%%%
Error msg
=======
|
064230 M SRT0001M parsing starts.
JOINKEYSFILES=F1064230 U MSGXXXXU
parsing error : syntax error at ","[line:0,col:3]
064230 E SRT6001E sort_cmd_parse() fails. rc=-111.
064230 E SRT6001E sortpar_parse fails. rc=-111
-111 stands for internal error
============================
Sample input/output will be same as in my first post.
I am not sure of which sort product the system uses[seems of IBM only], Could you please tell if there any command/way to check whose product
is it?
Thanks, |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
wouldn' t it be time to speak to Your support...
the forum is for zOS related stuff ...
the chances of getting help for SUN related thoings is pretty slim.
I also wonder what <thing> are You using on the SUN server which understands zOS jcl and <sort> control statements ? |
|
Back to top |
|
|
Amit S
New User
Joined: 30 Jul 2010 Posts: 17 Location: india
|
|
|
|
Oh,ok. I got the point. Thank you Enrico |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I am not sure of which sort product the system uses[seems of IBM only], Could you please tell if there any command/way to check whose product is it? |
Every sort product i've worked with provides product information when executed. . .
Which unix commands (script?) "execute" the sort jcl posted?
Might the "internal error" be due to statements that are NOT sort control statements (ie. the jcl posted)?
What led you to try to submit mainframe jcl/control statements on the unix system?
Someone who supports the unix system will know which sort product is used on that system. There is also the native unix "sort" command.
When i was a unix admin, we used Syncsort (which ran on HP-UX, AIX, and Sun. |
|
Back to top |
|
|
|