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

Problem Using Syncsort


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

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Tue Aug 23, 2011 3:37 pm
Reply with quote

I'm actually trying to extract certain fileds from each record of an Input file which has header, Body and the trailor record.

Im using the Outrec functionality to do this, which is working pretty much fine....

The problem is, The output record should contain the fields extracted from the input record, but along with that I also need a field from the header record to be appended at the end of each record...

For example....

I/P

UHL1 11223999999 000000001 DAILY 001 ------> Header
0901260484747901760131941465016 0000001
2011138047179801760131941465016 0000000

I want the o/p to be

09012604,8474790176,013194,1465016,11223999999
20111380,4717980176,013194,1465016,11223999999

all the fields above are same except 11223999999 which shld come from the header file to each record.....
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: Tue Aug 23, 2011 3:41 pm
Reply with quote

Can you look at the output messages from any old sort job that you have lying around, and just let us know what they start with. Even better, do you (reliably) know which sort product you have?

Won't make a big different to the solution, but you might be in the right, or the wrong, forum. Just checking.
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Tue Aug 23, 2011 3:44 pm
Reply with quote

Im not sure about the exact product... But my JCL looks step like this

//STEP030 EXEC PGM=SORT,PARM='SIZE=102400'
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Aug 23, 2011 3:45 pm
Reply with quote

narasimha.g wrote:
Im not sure about the exact product... But my JCL looks step like this

//STEP030 EXEC PGM=SORT,PARM='SIZE=102400'

Look at SYSOUT messages..

if you get ICE* messages then you have DFSORT
if you get WER* messages then you have SYNCSORT...
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Tue Aug 23, 2011 3:48 pm
Reply with quote

@ Escapa - thanks for that.... We have SYNCSORT here.....
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: Tue Aug 23, 2011 3:57 pm
Reply with quote

Well, I wish I'd asked that question. At least we know you are in the right place now, no late surprises with that.
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Tue Aug 23, 2011 4:31 pm
Reply with quote

is this impossible to do using a JCL????
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: Tue Aug 23, 2011 4:40 pm
Reply with quote

Yes, this is impossible to do with JCL.

It is possible with SORT, but SORT isn't JCL. SORT is a program. JCL runs programs and attaches the resources a program needs to the actually existing bits lying around here and there.

If you are just patient and nice, one of the SORT Wizards will probably come up with something for you.

If you are impatient, you may have to look elsewhere.

While waiting, how about digging up a manual and having a look yourself? Good way to pick up something along the way.
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Tue Aug 23, 2011 4:48 pm
Reply with quote

Thanks Bill.... ya i am doing it.... Ll try something else would write a cobol program to accomplish it.... or an Easytrieve program in the jcl SYSIN might also work.... not sure....
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: Tue Aug 23, 2011 4:57 pm
Reply with quote

Easytrieve would be, well, easy.

Any chance of going to the program that created the file and doing it there? That would be easiest of all.

SORT can do it. If you prefer Easytrieve, let us know. Maybe that is a way to light a fire under the Sort Wizards?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Aug 23, 2011 5:31 pm
Reply with quote

narasimha.g,

Here's a Syncsort job which would work for the example given.
I have assumed 'UHL' at pos-1 for the header record and that you do not need the header to be written into the output as shown in your example. The below sort assumes the input to be of FB/LRECL=80 and can be modified as per your real file attributes
Code:
//STEP01B  EXEC PGM=SORT                                             
//SYSOUT   DD  SYSOUT=*                                               
//SORTIN   DD  *                                                     
UHL1 11223999999 000000001 DAILY 001 ------> HEADER                   
0901260484747901760131941465016 0000001                               
2011138047179801760131941465016 0000000                               
//SORTOUT  DD  SYSOUT=*                                               
//SYSIN    DD  *                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'UHL'),                 
                PUSH=(81:6,11)),                                     
        IFTHEN=(WHEN=INIT,                                           
                BUILD=(1,8,C',',9,10,C',',19,6,C',',25,7,C',',81,11))
  SORT FIELDS=COPY                                                   
  OUTFIL INCLUDE=(1,3,CH,NE,C'UHL')       
SORTOUT had
Code:
09012604,8474790176,013194,1465016,11223999999
20111380,4717980176,013194,1465016,11223999999
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: Tue Aug 23, 2011 5:42 pm
Reply with quote

narasimha.g,

You excluded the header (and trailer) in your sample output. You should be able to cope with excluding the trailer from the cards shown, and to include both without amendments if that is what you actually want.
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Tue Aug 23, 2011 6:29 pm
Reply with quote

Arun Raj wrote:
narasimha.g,

Here's a Syncsort job which would work for the example given.
I have assumed 'UHL' at pos-1 for the header record and that you do not need the header to be written into the output as shown in your example. The below sort assumes the input to be of FB/LRECL=80 and can be modified as per your real file attributes
Code:
//STEP01B  EXEC PGM=SORT                                             
//SYSOUT   DD  SYSOUT=*                                               
//SORTIN   DD  *                                                     
UHL1 11223999999 000000001 DAILY 001 ------> HEADER                   
0901260484747901760131941465016 0000001                               
2011138047179801760131941465016 0000000                               
//SORTOUT  DD  SYSOUT=*                                               
//SYSIN    DD  *                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'UHL'),                 
                PUSH=(81:6,11)),                                     
        IFTHEN=(WHEN=INIT,                                           
                BUILD=(1,8,C',',9,10,C',',19,6,C',',25,7,C',',81,11))
  SORT FIELDS=COPY                                                   
  OUTFIL INCLUDE=(1,3,CH,NE,C'UHL')       
SORTOUT had
Code:
09012604,8474790176,013194,1465016,11223999999
20111380,4717980176,013194,1465016,11223999999


thanks very much arun....

My input file LRECL = 100... and hence i changed the code as follows

Code:
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'UHL'),                 
                PUSH=(101:6,11)),                                     
        IFTHEN=(WHEN=INIT,                                           
                BUILD=(1,8,C',',9,10,C',',19,6,C',',25,7,C',',101,11))



is it correct????
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: Tue Aug 23, 2011 6:38 pm
Reply with quote

Quote:
is it correct????


Did you test it????

Or

Yes, looks fine. Whack it into Production please. Just make sure the sign-off is indecipherable.
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Tue Aug 23, 2011 6:43 pm
Reply with quote

Bill Woodger wrote:
Quote:
is it correct????


Did you test it????

Or

Yes, looks fine. Whack it into Production please. Just make sure the sign-off is indecipherable.


i did check that but its abending... im sure it is because of the LRECL problem....

i actual scenario my input file is of 100 length and output would be LRECL 82
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: Tue Aug 23, 2011 6:51 pm
Reply with quote

And what do you want in the remaining bytes up to 82?

Is the file VB are FB?

What do you have as your SORTOUT?
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Tue Aug 23, 2011 8:20 pm
Reply with quote

im getting the below error...

SYSIN :
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'UHL'),
*
PUSH=(81:6,11)),
IFTHEN=(WHEN=INIT,
BUILD=(1,8,C',',9,10,C',',19,6,C',',25,7,C',',81,11))
SORT FIELDS=COPY
OUTFIL INCLUDE=(1,3,CH,NE,C'UHL')
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE



is it that it doesn support the functionality???? wht can be done now????
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Tue Aug 23, 2011 8:25 pm
Reply with quote

Bill Woodger wrote:
And what do you want in the remaining bytes up to 82?

Is the file VB are FB?

What do you have as your SORTOUT?


The example which i gave there was just a sample.... i have an input of lenght 100... i would be seleting more fields than i mentioned before..... but at end i need the field from the header to be appended.....

It is a FB file... and my SORTOUT is a FB dataset LRECL 82
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: Tue Aug 23, 2011 8:49 pm
Reply with quote

Maybe your SYNCSORT is not up-to-date?
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: Tue Aug 23, 2011 9:01 pm
Reply with quote

S-SAVE-HDR-VALUE S 11 A

JOB +
INPUT INFILE

IF INFILE-HDR-INDICATOR EQ "HDR"
S-SAVE-HDR-VALUE = INFILE-HDR-VALUE
GO TO JOB
END-IF

IF INFILE-TRL-INDICATOR EQ "TRL"
GO TO JOB
END-IF

* other stuff here for creating output record
OUTFILE-HDR-VALUE = S-SAVE-HDR-VALUE
OUTFILE : RECORD-LENGTH = 82
PUT OUTFILE
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Aug 24, 2011 2:47 pm
Reply with quote

narasimha.g wrote:
is it that it doesn support the functionality???? wht can be done now????
narasimha.g,

Are your sort control statements starting at pos-1?. From your error messages it looks so. It should be started from pos-2 or greater.

btw, which syncsort version are you running? AFAIK GROUP function is supported since Syncsort 1.3.2
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: Wed Aug 24, 2011 3:11 pm
Reply with quote

Looks so, because, as usual, not "coded". Click "quote" and spacing looks OK.
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Wed Aug 24, 2011 7:56 pm
Reply with quote

Arun Raj wrote:
narasimha.g wrote:
is it that it doesn support the functionality???? wht can be done now????
narasimha.g,

Are your sort control statements starting at pos-1?. From your error messages it looks so. It should be started from pos-2 or greater.

btw, which syncsort version are you running? AFAIK GROUP function is supported since Syncsort 1.3.2


im not sure abt the SYNC sort verion we are using... might be its not up to date..... i wrote a cobol program finally to accomplish that.... icon_sad.gif
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Wed Aug 24, 2011 8:07 pm
Reply with quote

Bill Woodger wrote:
Looks so, because, as usual, not "coded". Click "quote" and spacing looks OK.


Thanks Bill for the Help.... icon_smile.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Aug 24, 2011 8:15 pm
Reply with quote

Quote:
im not sure abt the SYNC sort verion we are using
Good that you have figured it out yourself. btw the Syncsort version info will be there on the top of the SYSOUT from any run.
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 Compare only first records of the fil... SYNCSORT 7
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
Search our Forums:

Back to Top