View previous topic :: View next topic
|
Author |
Message |
Venkata Ramayya
New User
Joined: 03 Dec 2007 Posts: 49 Location: United States
|
|
|
|
Hi,
Can we overlay in the different record using sort card? For example my file contains the data as below
=COLS> ----+----1----+----2----+----3----+----4----+----5
****** ***************************** Top of Data ********
000001 1
000002
000003
000004
000005
000006
000007
000008
000009
000010 123456789101
If the 000001 record has '1 ' I would like to add 'REPORT' in the 000009 record like below
=COLS> ----+----1----+----2----+----3----+----4----+----5
****** ***************************** Top of Data ********
000001 1
000002
000003
000004
000005
000006
000007
000008
000009 REPORT
000010 123456789101
Thanks
Venkat |
|
Back to top |
|
|
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
Hi, Venkata
Can u please explain your requirement in detail.
Suppose my i/p is
000001 1
000002
000003 1
000004
000005
000006 1
000007
000008
000009
000010 123456789101
What is the expected output? |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Venkata Ramayya,
The following DFSORT JCL will give you the desired results. I assumed that your input is FB recfm and lrecl of 80 bytes
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
000001 1
000002
000003
000004
000005
000006
000007
000008
000009
000010 123456789101
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=GROUP,BEGIN=(1,6,ZD,EQ,1,AND,8,1,ZD,EQ,1),
PUSH=(81:8,1),RECORDS=9),
IFTHEN=(WHEN=(1,6,ZD,EQ,9,AND,81,1,ZD,EQ,1),OVERLAY=(8:C'REPORT'))
/* |
|
|
Back to top |
|
|
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
Hi, Kolusu
I don't think this is the geralised way. What if I have more then 10 records.
This will work only for the example mentioned.
Please let me know if I am wrong.
Thanks And Regards
Rahul Gupta |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
rgupta71 wrote: |
Hi, Kolusu
I don't think this is the geralised way. What if I have more then 10 records. This will work only for the example mentioned.
Please let me know if I am wrong.
Thanks And Regards
Rahul Gupta |
Rahul gupta,
ofcourse you are wrong. My Job will work irrespective of the number of records in the file. Please don't assume when you can't test the solutions posted here. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
I don't think this is the geralised way. What if I have more then 10 records. |
the requirement was...
if the first record contains a "1"
then overlay the 9th record with the string "report"
and the solution satisfied it
if the requirement was to overlay the record before the last one ( regardless of the number of records )
the TS should have asked in a different way |
|
Back to top |
|
|
Venkata Ramayya
New User
Joined: 03 Dec 2007 Posts: 49 Location: United States
|
|
|
|
Thanks for the reply.
I would like to understand this
IFTHEN=(WHEN=GROUP,BEGIN=(1,6,ZD,EQ,1,AND,8,1,ZD,EQ,1),
Skolusu, can you please explain me?
I assume you understand that 000001,000002...000009 are record number when the file is in view mode. Actual record starts from '1'
'1 ' indicates the begining of the record and 8th record should have text 'REPORT'.
Please let me know if I confuse.
Thanks
Venkat |
|
Back to top |
|
|
Venkata Ramayya
New User
Joined: 03 Dec 2007 Posts: 49 Location: United States
|
|
|
|
Can any one respond to this?
I would like to understand this statement -
IFTHEN=(WHEN=GROUP,BEGIN=(1,6,ZD,EQ,1,AND,8,1,ZD,EQ,1),
PUSH=(81:8,1),RECORDS=9),
I am having issues when I customize this for my requirement.
Please help me.
Thanks
Venkat |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
venkat ramayya,
*sigh*. why do you want to paste line numbers as part of input data? I am not even sure as to what the requirement is. I don't want to guess.
For explanation of the GROUP statement check the User Guide for DFSORT PTF UK90013
Use [URL] BBCode for External Links |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Venkat,
If you want help with this, show a good example of your input records and what you expect for output. If you have more than one group of records that start with '1' and need 'REPORT', show that in your example. If you have only one group, say so. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input file. Give the starting position, length and format of each relevant field. |
|
Back to top |
|
|
Venkata Ramayya
New User
Joined: 03 Dec 2007 Posts: 49 Location: United States
|
|
|
|
Hi Frank,
Attached file has the input and output format. The Lrecl of input and output files are 133 FBA.
Please let me know if you have any questions.
Thanks
Venkat |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Venkata Ramayya,
Did you even bother to read frank's post? Answer all the questions of frank. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
That input and output shows ONE group of records. Is that all you have?
The "rules" you gave are "If the 000001 record has '1 ' I would like to add 'REPORT' in the 000009 record". What do you want to do if the 000001 record does not have '1'? Can any other record have '1'? Would that affect the expected output at all? |
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
Quote: |
*sigh*. why do you want to paste line numbers as part of input data? I am not even sure as to what the requirement is. I don't want to guess.
|
Venkata Ramayya did not paste line numbers as part of input data. Look at the original post again. It looks like a standard copy and paste from ISPF Edit. Cols was even used. It would have helped if code tags were used. We just did not carefully read what was posted. Any additional requirements would be helpful. |
|
Back to top |
|
|
Venkata Ramayya
New User
Joined: 03 Dec 2007 Posts: 49 Location: United States
|
|
|
|
The '1' indicates the begining of the each record. The every 8th record after 1(ie, 9th record including 1st record) should have 'Report' from 11th column. Let me know still you have any questions.
Thanks
Venkat |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
venkat ramayya,
Use the following DFSORT job
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=133,
IFTHEN=(WHEN=GROUP,BEGIN=(1,1,ZD,EQ,1),PUSH=(134:SEQ=8),RECORDS=9),
IFTHEN=(WHEN=(134,8,ZD,EQ,9),OVERLAY=(11:C'REPORT'))
/* |
|
|
Back to top |
|
|
Venkata Ramayya
New User
Joined: 03 Dec 2007 Posts: 49 Location: United States
|
|
|
|
Kolusu,
I am getting syntax error
SYSIN :
SORT FIELDS=COPY
INREC IFOUTLEN=133,
IFTHEN=(WHEN=GROUP,BEGIN=(1,1,ZD,EQ,1),PUSH=(134:SEQ=8),RECORDS=9),
*
IFTHEN=(WHEN=(134,8,ZD,EQ,9),OVERLAY=(11:C'REPORT'))
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Kolusu's job works fine with DFSORT. The WER messages indicate you're using Syncsort, not DFSORT.
Why did you post in the DFSORT Forum when you're using Syncsort? You should have posted in the JCL Forum.
Kolusu and I are DFSORT developers. DFSORT and Syncsort are competitive products. We're happy to answer questions on DFSORT and DFSORT's ICETOOL, but we don't answer questions on Syncsort. |
|
Back to top |
|
|
Venkata Ramayya
New User
Joined: 03 Dec 2007 Posts: 49 Location: United States
|
|
|
|
I appologize for it. Recently the product got changed from DF to SYNC in our work palce. I did not think about that and posted. Sorry again.
Thanks for your responses. |
|
Back to top |
|
|
|