Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Problem Using Syncsort
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Problem Using Syncsort
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Aug 23, 2011 3:41 pm    Post subject: Reply to: Problem Using SORT utility
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    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

@ Escapa - thanks for that.... We have SYNCSORT here.....
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Aug 23, 2011 3:57 pm    Post subject: Reply to: Problem Using Syncsort
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    Post subject:
Reply with quote

is this impossible to do using a JCL????
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Aug 23, 2011 4:40 pm    Post subject: Reply to: Problem Using Syncsort
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Aug 23, 2011 4:57 pm    Post subject: Reply to: Problem Using Syncsort
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: 2161
Location: @my desk

PostPosted: Tue Aug 23, 2011 5:31 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Aug 23, 2011 5:42 pm    Post subject: Reply to: Problem Using Syncsort
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Aug 23, 2011 6:38 pm    Post subject: Reply to: Problem Using Syncsort
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    Post subject: Re: Reply to: Problem Using Syncsort
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Aug 23, 2011 6:51 pm    Post subject: Reply to: Problem Using Syncsort
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    Post subject:
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    Post subject: Re: Reply to: Problem Using Syncsort
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Aug 23, 2011 8:49 pm    Post subject: Reply to: Problem Using Syncsort
Reply with quote

Maybe your SYNCSORT is not up-to-date?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Aug 23, 2011 9:01 pm    Post subject: Reply to: Problem Using Syncsort
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us