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

Question on existing Syncsort topic


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

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Aug 20, 2009 7:05 pm
Reply with quote

Hi,

The question is with reference to Syncsort - Retreiving the numeric values


I have used below input data and SORT job:
Code:

//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                       
ROOT11111 ACU00ACUPUNCTURE                           
CHILD2 ..ACU00DABB DABBDC                             
CHILD2 ..ACU00DAB1 DAB1DC                             
CHILD2 ..ACU00DAB2 DAB2DC                             
ROOTACU00 ACU00ACUPUNCTURE                           
CHILD ..ACU00DABB DABBDC                             
CHILD ..ACU00DAB1 DAB1DC                             
CHILD ..ACU00DAB2 DAB2DC                             
ROOT12345 ACU00ACUPUNCTURE                           
CHILD1 ..ACU00DABB DABBDC                             
CHILD1 ..ACU00DAB1 DAB1DC                             
CHILD1 ..ACU00DAB2 DAB2DC                             
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                       
  OPTION COPY                                               
  INREC IFTHEN=(WHEN=GROUP,                                 
    BEGIN=(1,4,CH,EQ,C'ROOT',AND,5,5,ZD,EQ,NUM),PUSH(81:ID=1))
/*                                                         


I am getting the below output (Not expected)..
Code:

ROOT11111 ACU00ACUPUNCTURE
CHILD2 ..ACU00DABB DABBDC
CHILD2 ..ACU00DAB1 DAB1DC
CHILD2 ..ACU00DAB2 DAB2DC
ROOTACU00 ACU00ACUPUNCTURE
CHILD ..ACU00DABB DABBDC 
CHILD ..ACU00DAB1 DAB1DC 
CHILD ..ACU00DAB2 DAB2DC 
ROOT12345 ACU00ACUPUNCTURE
CHILD1 ..ACU00DABB DABBDC
CHILD1 ..ACU00DAB1 DAB1DC
CHILD1 ..ACU00DAB2 DAB2DC


How to get the below result (Expected)...
Code:

ROOT11111 ACU00ACUPUNCTURE
CHILD2 ..ACU00DABB DABBDC
CHILD2 ..ACU00DAB1 DAB1DC
CHILD2 ..ACU00DAB2 DAB2DC
ROOT12345 ACU00ACUPUNCTURE
CHILD1 ..ACU00DABB DABBDC
CHILD1 ..ACU00DAB1 DAB1DC
CHILD1 ..ACU00DAB2 DAB2DC
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Aug 20, 2009 7:48 pm
Reply with quote

ramsri,

I dont think the WHEN=GROUP solution posted in the other thread will give you the desired results. Did you try the SYNCTOOL solution posted by me there?

Or If you're looking for a WHEN=GROUP solution, Change your SYSIN as below .
Code:
//SYSIN    DD *                               
  OPTION COPY                                 
  INREC IFTHEN=(WHEN=GROUP,                   
    BEGIN=(1,4,CH,EQ,C'ROOT'),PUSH(81:5,5))   
  OUTFIL INCLUDE=(81,5,FS,EQ,NUM),BUILD=(1,80)
/*
BTW you could have replied to the same topic instead of starting off a new topic.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Aug 20, 2009 8:09 pm
Reply with quote

Arun, somewhere I read that one should not open a very old thread....not sure. I thought it was achievable using WHEN=GROUP...

Ok....Thanks.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Aug 20, 2009 8:15 pm
Reply with quote

Arun, I tested it with both

Code:

OUTFIL INCLUDE=(81,5,FS,EQ,NUM),BUILD=(1,80)


and

Code:

OUTFIL INCLUDE=(81,5,ZD,EQ,NUM),BUILD=(1,80)


Why to use FS? Any specific reason?

Thanks.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Aug 20, 2009 8:26 pm
Reply with quote

Quote:
I thought it was achievable using WHEN=GROUP
Is it working now??
Quote:
Why to use FS? Any specific reason?
We just need a character numeric check here and FS will do exactly that. ZD will check for zoned decimal numerics. Both should work fine, but in this case only FS is required.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Aug 20, 2009 8:49 pm
Reply with quote

Oh...Yeah......it is working. The solutions given by you can't go wrong icon_biggrin.gif
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Aug 20, 2009 9:02 pm
Reply with quote

Arun, Why the the piece of code fails?

Code:

//SYSIN    DD *                                       
  OPTION COPY                                               
  INREC IFTHEN=(WHEN=GROUP,                                 
    BEGIN=(1,4,CH,EQ,C'ROOT',AND,5,5,ZD,EQ,NUM),PUSH(81:ID=1))
  OUTFIL INCLUDE=(81,1,ZD,GT,0),BUILD=(1,80)
/* 


I don't understand why it applies number to the CHARACTER data (ROOTACU00) where as the condition looks for "5,5,ZD,EQ,NUM !

Thanks.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Aug 20, 2009 10:48 pm
Reply with quote

Ramsri,

It's not failing. It is just doing whatever it has been asked to do. icon_biggrin.gif
Code:
BEGIN=(1,4,CH,EQ,C'ROOT',AND,5,5,ZD,EQ,NUM),PUSH(81:ID=1))
will identify the start of a new GROUP whenever it encounters a 'ROOTnnnnn' where n=0 thru 9. Remember it does not specify where the GROUP should end. Hence in the above example you have an unwanted GROUP starting with 'ROOTACU00' in between; but the 'PUSH'ing of ID field is continued until the beginning of another 'ROOTnnnnn'. Hope it's clear to you now.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Aug 21, 2009 9:19 am
Reply with quote

Arun, I am happy that my assumption is true. Thanks for the details.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Aug 21, 2009 9:24 am
Reply with quote

You're welcome. icon_smile.gif
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Aug 21, 2009 9:38 am
Reply with quote

Arun, is it still possible to code a BEGIN and END to achieve what is achieved with other way around?

Thanks.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Aug 21, 2009 9:49 am
Reply with quote

Here we dont have anything specific in the input data which identifies the ending of a GROUP. Why do you need a solution using both 'BEGIN' and 'END' when a BEGIN alone would do the same.icon_biggrin.gif
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Aug 21, 2009 12:37 pm
Reply with quote

I am not looking for the BEGIN and END solution but wanted know if it is possible icon_confused.gif
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 Adding first / last acct numerber to ... DFSORT/ICETOOL 7
No new posts Question for file manager IBM Tools 7
No new posts question for Pedro TSO/ISPF 2
No new posts I want to append a record in an exist... CLIST & REXX 17
Search our Forums:

Back to Top