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

Condition in GROUP


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

New User


Joined: 05 Dec 2012
Posts: 5
Location: USA

PostPosted: Wed Dec 05, 2012 7:57 am
Reply with quote

Hi my input file is


Code:
  MMM-FIELD-S                                 
  MMM-FIELD-1
 *MMM-FIELD-2
  MMM-FIELD-E
  MMM-FIELD-1
  MMM-FIELD-S
 *MMM-FIELD-1
  MMM-FIELD-2
  MMM-FIELD-E
  MMM-FIELD-S
  MMM-FIELD-1
  MMM-FIELD-2
  MMM-FIELD-3
  MMM-FIELD-E


My output should be like this

Code:
  MMM-FIELD-S                                 
  MMM-FIELD-1
 *MMM-FIELD-2
  MMM-FIELD-E
 MMM-FIELD-S
 *MMM-FIELD-1
  MMM-FIELD-2
  MMM-FIELD-E



I used group command to get the above input file, now from those i want to pick the records which has '*' as first character within the group ( i.e Begin MMM-FIELD-S and the end MMM-FIELD-E)

Please let me know whether this is posible , if so let me know how
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: Wed Dec 05, 2012 8:20 am
Reply with quote

Hello and welcome to the forum,

Is there some reason to run one Sort process just to create input to another?

If you post the original input (with something that looks like real data rather than the alphabet soup) and the final output needed when the sample input is processed, you may have more luck getting help.

I don't understand your "rules" to get from the input to the output. Clarification would help.

What are the recfm and lrecl of the input and output files?

When posting the data, please use the Code tag to preserve alignment and improve readability. There is a Preview so you can see your post as it will be seen by the forum.
Back to top
View user's profile Send private message
Emmanual123

New User


Joined: 05 Dec 2012
Posts: 5
Location: USA

PostPosted: Wed Dec 05, 2012 9:11 am
Reply with quote

Thankyou for the reply.....

Its like I have an input file , with the below mentioned format


Code:
  Member-ID                       112354
  member-group                  d234555
  Member-benifit-cd              b1
 *Member-effective date       20101111
 *member-expirydate           99999999
  member-accum-amt           10678
  member-division                123
  Member-ID                       112354
  member-group                  d234555
  Member-effective date       20101111
  member-expirydate           99999999
  member-accum-amt           10678
  member-division                123
  Member-ID                       112354
  member-group                  d234555
  Member-benifit-cd              b1
  Member-effective date       20101111
 *member-expirydate           99999999
 *member-accum-amt           10678
  member-division                123
  Member-ID                       112354
  member-group                  d234555
  Member-benifit-cd              b1
  member-expirydate           99999999
  member-accum-amt           10678
  member-division                123
  Member-ID                       112354
  member-group                  d234555
  Member-benifit-cd              b1
  Member-effective date       20101111
 *member-expirydate           99999999
  member-accum-amt           10678
  member-division                123


the * will be at 2nd column, the fields will start at 3rd column....

the file length is 133

The group will start with the field Member-id and Ends with member-divison..... between those fields there will be many fields .... in one case there are five fields or three in another case -....

'*' will be there only in the fields between start and end

I want to pick up the group along with the fields which has '*' at any one of the fields


The output should be like this

Code:
  Member-ID                       112354
  member-group                  d234555
  Member-benifit-cd              b1
 *Member-effective date       20101111
 *member-expirydate           99999999
  member-accum-amt           10678
  member-division                123
  Member-ID                       112354
  member-group                  d234555
  Member-benifit-cd              b1
  Member-effective date       20101111
 *member-expirydate           99999999
 *member-accum-amt           10678
  member-division                123
  Member-ID                       112354
  member-group                  d234555
  Member-benifit-cd              b1
  Member-effective date       20101111
 *member-expirydate           99999999
  member-accum-amt           10678
  member-division                123


I cannot put screen shots...

Please let me know if you need more info
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Dec 05, 2012 9:27 am
Reply with quote

What is your product DFSORT or SYNCSORT?

Also in future please make use of Code tags
Back to top
View user's profile Send private message
Emmanual123

New User


Joined: 05 Dec 2012
Posts: 5
Location: USA

PostPosted: Wed Dec 05, 2012 9:32 am
Reply with quote

Syncsort ....
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Dec 05, 2012 9:39 am
Reply with quote

This space belongs to DFSORT queries

Does your version support WHEN=GROUP and symnames?
Back to top
View user's profile Send private message
Emmanual123

New User


Joined: 05 Dec 2012
Posts: 5
Location: USA

PostPosted: Wed Dec 05, 2012 10:18 am
Reply with quote

oops...

yes it supports symnames and group
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Dec 05, 2012 10:55 am
Reply with quote

Hi,

try this

Code:
//S1       EXEC PGM=SORT             
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD *                       
MMM-FIELD-S                           
MMM-FIELD-1                           
*MMM-FIELD-2                         
MMM-FIELD-E                           
MMM-FIELD-1                           
MMM-FIELD-S                           
*MMM-FIELD-1                         
MMM-FIELD-2                           
MMM-FIELD-E                           
MMM-FIELD-S                           
MMM-FIELD-1                           
MMM-FIELD-2                           
MMM-FIELD-3                           
MMM-FIELD-E                           
//ALL      DD DSN=&&ALL,             
//            DISP=(,PASS,DELETE),                   
//            UNIT=SYSDA,                             
//            SPACE=(TRK,(10,5),RLSE)                 
//WANTED   DD DSN=&&WANTED,                           
//            DISP=(,PASS,DELETE),                   
//            UNIT=SYSDA,                             
//            SPACE=(TRK,(10,5),RLSE)                 
//SYSIN    DD *                                       
  OPTION COPY                                         
  INREC IFTHEN=(WHEN=GROUP,                           
                BEGIN=(1,11,CH,EQ,C'MMM-FIELD-S'),   
                  END=(1,11,CH,EQ,C'MMM-FIELD-E'),   
                 PUSH=(81:ID=4))                     
  OUTFIL    FNAMES=ALL,INCLUDE=(81,4,ZD,GE,+1),       
                    BUILD=(1,84)                     
  OUTFIL FNAMES=WANTED,INCLUDE=(1,1,CH,EQ,C'*'),     
                    BUILD=(81,4)                     
/*                                                   
//S2       EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTJNF1 DD DSN=&&WANTED,                             
//            DISP=SHR                                 
//SORTJNF2 DD DSN=&&ALL,                               
//            DISP=SHR                                 
//SORTOUT DD SYSOUT=*                                   
//SYSIN DD *                                           
  JOINKEYS FILE=F1,FIELDS=(01,04,A),SORTED             
  JOINKEYS FILE=F2,FIELDS=(81,04,A),SORTED             
  REFORMAT FIELDS=(F2:01,80)                           
  SORT FIELDS=COPY                                     
/*                                                     


Gerry
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 Dec 05, 2012 3:38 pm
Reply with quote

Emmanual123,

If your SyncSort supports JNFnCNTL files (consult your documentation) then Gerry's solution can be applied in one step.
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Wed Dec 05, 2012 3:51 pm
Reply with quote

Emmanual123,

Can you please post expected output for example you shown. i.e.
Code:

  Member-ID                       112354
  member-group                  d234555
  Member-benifit-cd              b1
 *Member-effective date       20101111
 *member-expirydate           99999999
  member-accum-amt           10678
  member-division                123
  Member-ID                       112354
  member-group                  d234555
  Member-benifit-cd              b1
  Member-effective date       20101111
 *member-expirydate           99999999
 *member-accum-amt           10678
  member-division                123
  Member-ID                       112354
  member-group                  d234555
  Member-benifit-cd              b1
  Member-effective date       20101111
 *member-expirydate           99999999
  member-accum-amt           10678
  member-division                123


I think it will be whole file as it is in this case
Back to top
View user's profile Send private message
Emmanual123

New User


Joined: 05 Dec 2012
Posts: 5
Location: USA

PostPosted: Thu Dec 06, 2012 9:25 am
Reply with quote

Thank You gcicchet , it worked. Thank you all ..........
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: Thu Dec 06, 2012 8:51 pm
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

d
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 latest 2 rows of a table usin... DB2 1
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Splitting group records based on deta... DFSORT/ICETOOL 8
No new posts How to give complex condition in JCL . CLIST & REXX 30
No new posts selectively copy based on condition DFSORT/ICETOOL 3
Search our Forums:

Back to Top