|
View previous topic :: View next topic
|
| Author |
Message |
Poha Eater
New User

Joined: 31 Aug 2016 Posts: 74 Location: India
|
|
|
|
Hi All,
I have a PS file which is 18 bytes long. Each record is exactly 18 byte long. I have to insert a 3-byte character on position 1 in the file based on some conditions. Below is the sort card i am currently using :
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=INIT,
IFTHEN=(WHEN=(9,3,CH,EQ,'000'),OVERLAY=(1:C'GGA')),
IFTHEN=(WHEN=(9,3,CH,EQ,'IM1'),OVERLAY=(1:C'GGA')),
IFTHEN=(WHEN=(10,3,CH,EQ,' 4'),OVERLAY=(1:C'GGA')),
IFTHEN=(WHEN=(10,3,CH,EQ,' 3'),OVERLAY=(1:C'GGA')),
IFTHEN=(WHEN=(9,2,CH,EQ,'WG'),OVERLAY=(1:C'AFG')),
IFTHEN=(WHEN=(9,3,CH,EQ,'IUL'),OVERLAY=(1:C'AFG')),
IFTHEN=(WHEN=(9,2,CH,EQ,'UL'),OVERLAY=(1:C'AFG')),
IFTHEN=(WHEN=(7,3,CH,EQ,' T'),OVERLAY=(1:C'AFG')),
IFTHEN=(WHEN=(9,2,CH,EQ,'23'),OVERLAY=(1:C'023'))),
/* |
After several hit and trials i am still getting the error. I am missing something here. Can anyone please help me to complete this.
Input File : (Each record is exactly 18 bytes long. Every record has variable number of spaces in the beginning. Spaces may not be visible after posting this.)
| Code: |
----+----1----+---
0000L01762
4875851
IM10000929
3400009
WG10004785
IUL1000016
UL10000006
T700000011
2307900026 |
Expected Output : (Output file will also have length of 18 bytes)
| Code: |
CGA 0000L01762
CGA 4875851
CGA IM10000929
CGA 3400009
LFG WG10004785
LFG IUL1000016
LFG UL10000006
LFG T700000011
023 2307900026
|
Thanks a lot in advance !! |
|
| Back to top |
|
 |
Poha Eater
New User

Joined: 31 Aug 2016 Posts: 74 Location: India
|
|
|
|
This is the expected output. By mistake i wrote the wrong expected output in my topic. Below is the correct expected output :
| Code: |
GGA 0000L01762
GGA 4875851
GGA IM10000929
GGA 3400009
AFG WG10004785
AFG IUL1000016
AFG UL10000006
AFG T700000011
023 2307900026
|
|
|
| Back to top |
|
 |
Poha Eater
New User

Joined: 31 Aug 2016 Posts: 74 Location: India
|
|
|
|
| Thanks Magesh. I will keep this in mind going forward. |
|
| Back to top |
|
 |
magesh23586
Active User

Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
All your conditions are matching with 1,3(offset,length) or 1,2 or 1,1 why are you handling at 9th byte or 10th byte ?
Instead of
| Code: |
IFTHEN=(WHEN=(9,3,CH,EQ,'000'),OVERLAY=(1:C'GGA')),
|
you should have ?
| Code: |
IFTHEN=(WHEN=(1,3,CH,EQ,C'000'),OVERLAY=(1:C'GGA',4:1,15)),
|
May be you can try below code, untested
| Code: |
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(1,3,CH,EQ,C'000'),
OVERLAY=(1:C'GGA',4:1,15)),
IFTHEN=(WHEN=(1,3,CH,EQ,C'IM1'),
OVERLAY=(1:C'GGA',4:1,15)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'4'),
OVERLAY=(1:C'GGA',4:1,15)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'3'),
OVERLAY=(1:C'GGA',4:1,15)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'WG'),
OVERLAY=(1:C'AFG',4:1,15)),
IFTHEN=(WHEN=(1,3,CH,EQ,C'IUL'),
OVERLAY=(1:C'AFG',4:1,15)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'UL'),
OVERLAY=(1:C'AFG',4:1,15)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'T'),
OVERLAY=(1:C'AFG',4:1,15)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'23'),
OVERLAY=(1:C'023',4:1,15)),
IFTHEN=(WHEN=NONE,
OVERLAY=(1:3X,4:1,15)))
|
|
|
| Back to top |
|
 |
Poha Eater
New User

Joined: 31 Aug 2016 Posts: 74 Location: India
|
|
|
|
Hi Magesh,
Thanks for the quick reply. I have tried your code but getting some errors. The input file was created after FTP a notepad file to Mainframe.
The data in the input is starting from 9th or 10th byte. When the post was pasted here, it somehow removed the leading spaces from all the records that is why it is showing that the data is starting from 1st byte. I am pasting the input file below :
| Code: |
0000L01762
4875851
IM10000929
3400009
WG10004785
IUL1000016
UL10000006
T700000011
2307900026
|
Error i am getting :
| Code: |
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(9,3,ZD,EQ,000),OVERLAY=(1:C'GGA',4:4,15)),
IFTHEN=(WHEN=(9,3,CH,EQ,'IM1'),OVERLAY=(1:C'GGA',4:4,15)),
$
ICE113A E COMPARISON FIELD ERROR
IFTHEN=(WHEN=(10,3,ZD,CH,' 4'),OVERLAY=(1:C'GGA',4:4,15)),
$
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
IFTHEN=(WHEN=(10,3,CH,EQ,' 3'),OVERLAY=(1:C'GGA',4:4,15)),
$
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
IFTHEN=(WHEN=(9,2,CH,EQ,'WG'),OVERLAY=(1:C'AFG',4:4,15)),
$
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
IFTHEN=(WHEN=(9,3,CH,EQ,'IUL'),OVERLAY=(1:C'AFG',4:4,15)),
$
|
I can really use some guidance here because i need to deliver this tomorrow anyhow. As of now i am testing this on a sample data. Once it works here then i need to run same conditions on a file which contains more than 600,000 records so Please help !!
Thanks a lot in advance. |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10902 Location: italy
|
|
|
|
| Quote: |
I can really use some guidance here because i need to deliver this tomorrow anyhow.
|
You should remember that people answer
ON THEIR OWN TIME
FREE OF CHARGE
if You have time constraints a forum is not the place to ask for help
a paid consultant - for the proper fee - will be happy to provide assistance according to your plans |
|
| Back to top |
|
 |
Poha Eater
New User

Joined: 31 Aug 2016 Posts: 74 Location: India
|
|
|
|
Hi Enrico,
You are right, my bad !
Thanks ! |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10902 Location: italy
|
|
|
|
the DFSORT manuals, or a simple search of the forums will certainly tell
the proper format of the comparison statement
if You had done the due diligence You should not have had the need to ask
and ... why in &heaven didn' t You follow the syntax of Magesh suggestion ? |
|
| Back to top |
|
 |
Poha Eater
New User

Joined: 31 Aug 2016 Posts: 74 Location: India
|
|
|
|
Hi Enrico,
The data in the file is starting from 9th byte instead of 1st byte. In each data there are leading spaces that is why i wrote the SORT card starting from 9th byte instead of 1st byte as Magesh suggested.
The input file was created after FTP a Notepad file. This is why i am confused about the data type which i need to mentioned in SORT card.
| Code: |
IFTHEN=(WHEN=(9,3,CH,EQ,'IM1'),OVERLAY=(1:C'GGA',4:4,15)),
$
ICE113A E COMPARISON FIELD ERROR
|
'IM1' seems to be a character format and that is why i have given CH here but it is giving comparison field error. I am not sure what else i can give here to make it work.
(Mod: corrected cut'n'paste in this post. Cleaned up earlier posts) |
|
| Back to top |
|
 |
Poha Eater
New User

Joined: 31 Aug 2016 Posts: 74 Location: India
|
|
|
|
Hi Enrico,
I get your point when you said :
| Quote: |
| and ... why in &heaven didn' t You follow the syntax of Magesh suggestion ? |
I have realized now where i was missing and corrected the syntax as per Magesh.
I am getting the expected output.
Thanks a lot Magesh and Enrico.  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|