View previous topic :: View next topic
Author
Message
mksranjani New User Joined: 03 Feb 2010Posts: 29 Location: Chennai
Hi,
I have a file with data as below
Code:
----+----1----+----2----+----3----+----4----+----5----+----6-
***************************** Top of Data *******************
abcdefg.txt
cd aaaaaa
cd bbbbbb
cd ccccccc
cd ddddddd
locsite pri=5 cy sec=1 cy u=testda rec=fb lr=1402 blocksi=0
get +
USER.NONX.USER9999.SAMPLE(+1)'
quit
I need the output as below. The data in first line 'abcdefg.txt' needs to be moved after 'get' in 7th line.
Code:
----+----1----+----2----+----3----+----4----+----5----+----6-
***************************** Top of Data *******************
cd aaaaaa
cd bbbbbb
cd ccccccc
cd ddddddd
locsite pri=5 cy sec=1 cy u=testda rec=fb lr=1402 blocksi=0
get abcdefg.txt +
USER.NONX.USER9999.SAMPLE(+1)'
quit
**************************** Bottom of Data *****************
Please help to achieve this solution using Sort
Back to top
Nic Clouston Global Moderator Joined: 10 May 2007Posts: 2455 Location: Hampshire, UK
Well, you've already done it now so what is the problem?
Back to top
mksranjani New User Joined: 03 Feb 2010Posts: 29 Location: Chennai
Oh, no. I have just given how the output should look like.
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
With IFTHEN and WHEN=GROUP with RECORDS you can PUSH your filename. Include a SEQ.
with IFTHEN and WHEN=(logexp) you can identify the "get " and put the PUSHed item into the appropriate place.
Then on OUTFIL OMIT when the sequence is one to get rid of the now surplus record, and BUILD to get rid of the PUSHed data.
Back to top
Pandora-Box Global Moderator Joined: 07 Sep 2006Posts: 1592 Location: Andromeda Galaxy
Bill,
Not sure how much effective this could be
If the file name abcdefg.txt going to be same always
Omit record with abcdefg.txt in first position
Change all get to get abcdefg.txt
Please correct me
Back to top
mksranjani New User Joined: 03 Feb 2010Posts: 29 Location: Chennai
Bill,
Could you please give a sample code with what you have suggested
Back to top
Pandora-Box Global Moderator Joined: 07 Sep 2006Posts: 1592 Location: Andromeda Galaxy
Quote:
Could you please give a sample code with what you have suggested
He did infact gave you the exact syntax
As your duty you could search the forum/Manual for samples and try learning them on how it works and implement it as your need
So in future you shall not depend on anyone for the similar requests
Back to top
dbzTHEdinosauer Global Moderator Joined: 20 Oct 2006Posts: 6966 Location: porcelain throne
mksranjani wrote:
Bill,
Could you please give a sample code with what you have suggested
and the beat goes on!
ifpltaatrtimclid.
hey, this first letter stuff is great!
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
Frank Yaeger wrote:
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
Pandora-Box wrote:
Bill,
Not sure how much effective this could be
If the file name abcdefg.txt going to be same always
Omit record with abcdefg.txt in first position
Change all get to get abcdefg.txt
Please correct me
Yes, that would work.
You'd do it with the editor, and put it in a PDS/PDSE member... :-)
I was assuming, and I can easily be wrong, that the content of the first record is variable and a generalised solution was sought.
ywanicratmbwilfasstyp,
(yes dbz, it is fun) if you can't be bothered to look at the manuals, at least search the forum for the key words I gave you (they were real words, not abbreviations of expressions) and you should be able to get it.
Back to top
knickraj Warnings : 1 New User Joined: 11 Jun 2007Posts: 50 Location: Euro
sample code...
Code:
//STEP EXEC SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ABCDEFG.TXT
CD AAAAAA
CD BBBBBB
CD CCCCCCC
CD DDDDDDD
LOCSITE PRI=5 CY SEC=1 CY U=TESTDA REC=FB LR=1402 BLOCKSI=0
GET +
USER.NONX.USER9999.SAMPLE(+1)'
QUIT
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'GET'),OVERLAY=(5:C'ABCDEFG.TXT'))
OMIT COND=(1,11,CH,EQ,C'ABCDEFG.TXT')
Code:
//STEP EXEC SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ABCDEFG.TXT
CD AAAAAA
CD BBBBBB
CD CCCCCCC
CD DDDDDDD
LOCSITE PRI=5 CY SEC=1 CY U=TESTDA REC=FB LR=1402 BLOCKSI=0
GET +
USER.NONX.USER9999.SAMPLE(+1)'
QUIT
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,11,CH,EQ,C'ABCDEFG.TXT'),
END=(1,3,CH,EQ,C'GET'),
PUSH=(81:1,11)),
IFTHEN=(WHEN=(1,3,CH,EQ,C'GET'),OVERLAY=(5:81,11))
OUTFIL OMIT=(1,11,CH,EQ,C'ABCDEFG.TXT'),BUILD=(1,80)
P.S, I have used CAPS ON.
Back to top
mksranjani New User Joined: 03 Feb 2010Posts: 29 Location: Chennai
Hi,
I have coded the below sort. But it is showing error. Can someone please help,
Code:
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,RECORDS=9,PUSH=(81:ID=1,83:SEQ=1),
IFTHEN=(WHEN=(1,3,CH,EQ,'get',AND,81,1,ZD,EQ,1),PUSH=(81:1,32))
OUTFIL OMIT=(SEQ=1),BUILD=(1,80)
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
Is there some reason you have not posetd the error(s)
You need to post all of the diagnostic information generated including the complete message id(s).
Back to top
mksranjani New User Joined: 03 Feb 2010Posts: 29 Location: Chennai
Sorry, please find below the error message
Code:
SYSIN :
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,RECORDS=9,PUSH=(81:ID=1))
INREC IFTHEN=(WHEN=(1,3,CH,EQ,'get',AND,81,1,ZD,EQ,1),PUSH=(81:1,32))
*
OUTFIL OMIT=(SEQ=1),BUILD=(1,80)
*
WER269A INREC STATEMENT : DUPLICATE STATEMENT FOUND
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10873 Location: italy
the WER.... messages indicate that You are using SYNCSORT, not DFSORT
topic moved where it belongs
Back to top
mksranjani New User Joined: 03 Feb 2010Posts: 29 Location: Chennai
Knick,
'ABCDEFG.txt' is a variable. It is not the same always.
Back to top
Pandora-Box Global Moderator Joined: 07 Sep 2006Posts: 1592 Location: Andromeda Galaxy
Also If your
abcdefg.txt file name is not going to change
The other solution by Knickraj should work for Syncsort
Back to top
Pandora-Box Global Moderator Joined: 07 Sep 2006Posts: 1592 Location: Andromeda Galaxy
So you can make use of SYMNAMES and reformat using Knick's solution
Back to top
Akatsukami Global Moderator Joined: 03 Oct 2009Posts: 1788 Location: Bloomington, IL
mksranjani wrote:
Hi,
I have coded the below sort. But it is showing error. Can someone please help,
Code:
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,RECORDS=9,PUSH=(81:ID=1,83:SEQ=1),
IFTHEN=(WHEN=(1,3,CH,EQ,'get',AND,81,1,ZD,EQ,1),PUSH=(81:1,32))
OUTFIL OMIT=(SEQ=1),BUILD=(1,80)
which is not the same as
Quote:
Code:
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,RECORDS=9,PUSH=(81:ID=1))
INREC IFTHEN=(WHEN=(1,3,CH,EQ,'get',AND,81,1,ZD,EQ,1),PUSH=(81:1,32))
OUTFIL OMIT=(SEQ=1),BUILD=(1,80)
How can you expect meaningful help if you do not tell us what you have actually done?
Back to top
Pandora-Box Global Moderator Joined: 07 Sep 2006Posts: 1592 Location: Andromeda Galaxy
Also 'get' should be C'get'
I find it wrong atleast
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
Make the change pointed out by Pandora-Box. I would always include at least one space, so that I know I've got "get" not something which begins with "get".
Also look to your OMIT. You can't do SEQ like that. You need to define where the GROUP PUSHed the SEQ and then test that for one.
If this doesn't get it, post the whole sysout.
Back to top
knickraj Warnings : 1 New User Joined: 11 Jun 2007Posts: 50 Location: Euro
try this..
Code:
//STEP EXEC SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ABCDEFG.TXT
CD AAAAAA
CD BBBBBB
CD CCCCCCC
CD DDDDDDD
LOCSITE PRI=5 CY SEC=1 CY U=TESTDA REC=FB LR=1402 BLOCKSI=0
GET
USER.NONX.USER9999.SAMPLE(+1)'
QUIT
//SORTOUT DD DSN=&&T,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,BUILD=(80X),
HEADER1=('FILE,C''',1,11,'''')
//STEP EXEC SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&T,DISP=SHR
//SORTOUT DD SYSOUT=*
//SORTIN DD *
ABCDEFG.TXT
CD AAAAAA
CD BBBBBB
CD CCCCCCC
CD DDDDDDD
LOCSITE PRI=5 CY SEC=1 CY U=TESTDA REC=FB LR=1402 BLOCKSI=0
GET
USER.NONX.USER9999.SAMPLE(+1)'
QUIT
//SYSIN DD *
OPTION COPY
OMIT COND=(1,11,CH,EQ,FILE)
INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'GET'),OVERLAY=(5:FILE))
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
Quote:
OUTFIL OMIT=(SEQ=1),BUILD=(1,80)
Suggest you try removing
OMIT=(SEQ=1), and try again.
Back to top
mksranjani New User Joined: 03 Feb 2010Posts: 29 Location: Chennai
I have tried removing OMIT. Below is the error i got
Code:
SYSIN :
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,RECORDS=9,PUSH=(81:ID=1)),
IFTHEN=(WHEN=(1,3,CH,EQ,C'get',AND,81,1,ZD,EQ,1),PUSH=(81:1,32))
*
OUTFIL BUILD=(1,80)
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
What is the lrecl of the files?
Back to top
Please enable JavaScript!