View previous topic :: View next topic
|
Author |
Message |
Emmanual123
New User
Joined: 05 Dec 2012 Posts: 5 Location: USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Emmanual123
New User
Joined: 05 Dec 2012 Posts: 5 Location: USA
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
What is your product DFSORT or SYNCSORT?
Also in future please make use of Code tags |
|
Back to top |
|
|
Emmanual123
New User
Joined: 05 Dec 2012 Posts: 5 Location: USA
|
|
|
|
Syncsort .... |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
This space belongs to DFSORT queries
Does your version support WHEN=GROUP and symnames? |
|
Back to top |
|
|
Emmanual123
New User
Joined: 05 Dec 2012 Posts: 5 Location: USA
|
|
|
|
oops...
yes it supports symnames and group |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Emmanual123,
If your SyncSort supports JNFnCNTL files (consult your documentation) then Gerry's solution can be applied in one step. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
Emmanual123
New User
Joined: 05 Dec 2012 Posts: 5 Location: USA
|
|
|
|
Thank You gcicchet , it worked. Thank you all .......... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for letting us know
d |
|
Back to top |
|
|
|