Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sequence Number Update

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Thu Jan 19, 2012 6:37 pm    Post subject: Sequence Number Update
Reply with quote

Hi,

I have a requirement where in I need to update sequence number field at variable position. File is variable length and maximum length is 1014 . Input data will be in below format

<Name>ABC</Name><Address>Address1</Address><City>US</City><DateOfBirth>1983-03-03</DateOfBirth><LocaleCode>VFC</LocaleCode><NameLine>AYUSH</NameLine> <SequenceNum>00000018</SequenceNum><StatusCode>I</StatusCode><Status>Married</Status> <MailID>abc</MailID><Age>23</Age><Telephone>123456</Telephone><SequenceNum>00000021</SequenceNum><Occupation>Student</Occupation><Name>ABC</Name><Add>Address1</Add><SequenceNum>00000021</SequenceNum> <City>US</City><DateOfBirth>1983-03-03</DateOfBirth>

Output will be like this

<Name>ABC</Name><Address>Address1</Address><City>US</City><DateOfBirth>1983-03-03</DateOfBirth><LocaleCode>VFC</LocaleCode><NameLine>AYUSH </NameLine> <SequenceNum>00000001</SequenceNum><StatusCode>I</StatusCode><Status>Married</Status> <MailID>abc</MailID><Age>23</Age><Telephone>123456</Telephone><SequenceNum>00000002</SequenceNum><Occupation>Student</Occupation><Name>ABC</Name><Add>Address1</Add><SequenceNum>00000003</SequenceNum> <City>US</City><DateOfBirth>1983-03-03</DateOfBirth>


How can we achieve this using DFSORT?

Thanks,
Indrajit
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Thu Jan 19, 2012 6:44 pm    Post subject: Reply to: Sequence Number Update
Reply with quote

Can you split it into individual elements, like your last question? The sequence is then in a fixed position.
Back to top
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Thu Jan 19, 2012 6:47 pm    Post subject:
Reply with quote

I thought of that option first, but now the requirement has changed and they want the input data to be kept as is and just to update the SequenceNum in the same place it is present in the input file.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jan 19, 2012 10:24 pm    Post subject:
Reply with quote

Indrajit_57,

How many times are you going to post the same question? Didn't you try the solution listed here?

http://www.ibmmainframes.com/viewtopic.php?t=55979&highlight=xml
Back to top
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Sat Jan 21, 2012 4:21 am    Post subject:
Reply with quote

I have tried that solution, reason I m posting this again because of following input change :-

1. One line can have multiple sequence number field.
2. File length is 1014.
3. After modification of previous sort as per new requirement, I m getting output as follow

<Name>ABC</Name><Address>Address1</Address><City>US</City><DateOfBirth>1983-03-03</DateOfBirth><LocaleCode>VFC</LocaleCode><NameLine>AYUSH</NameLine> <SequenceNum>StatusCode>I</StatusCode><Status>Married</Status> <MailID>abc</MailID><Age>23</Age><Telephone>123456</Telephone>00000001</SequenceNum><SequenceNum>Occupation>Student</Occupation><Name>ABC</Name><Add>Address1</Add><SequenceNum> 0000002</SequenceNum><<City>US</City><DateOfBirth>1983-03-03</DateOfBirth>

Modified sort card is

OPTION COPY
INREC IFOUTLEN=1014,
IFTHEN=(WHEN=(1,1014,SS,EQ,C'<SequenceNum>'),
BUILD=(C'"',1,1014),HIT=NEXT),
IFTHEN=(WHEN=(1,1,CH,EQ,C'"'),
FINDREP=(SHIFT=NO,IN=C'<SequenceNum>',
OUT=C'<SequenceNum>" '),HIT=NEXT),
IFTHEN=(WHEN=(1,1,CH,EQ,C'"'),
OVERLAY=(1016:SEQNUM,8,FS,C'</SequenceNum>',
1:1,1038,SQZ=(SHIFT=LEFT,PAIR=QUOTE)),HIT=NEXT),
IFTHEN=(WHEN=(1,1,CH,EQ,C'"'),
FINDREP=(IN=C'"',OUT=C''))
Back to top
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Sat Jan 21, 2012 4:29 am    Post subject:
Reply with quote

Please ignore the above output.
What I am getting now is that the sequence number and the ending tag is always coming at the end of the record and not following the start of the sequence number tag.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Jan 21, 2012 5:21 am    Post subject:
Reply with quote

Indrajit_57,

DFSORT does NOT have any feature to handle multiple occurrences of the <SequenceNum> tags and update them. A simple COBOL program should be able to do this easily.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Mon Jan 23, 2012 9:38 pm    Post subject: Reply to: Sequence Number Update
Reply with quote

Indrajit_57,

Are you OK with this now?

You have the rexx example enrico posted on a previous question. I can get to the following with Cobol, if you have need of more than the sequence number. If you just need the sequence, even simpler:
Code:

0019ENTRIES
FOR NUMBER =0001= ENTRY
XML IS  =<NAME>ABC</NAME>=
TAG IS  =<NAME>=
DATA IS =ABC=
FOR NUMBER =0002= ENTRY
XML IS  =<ADDRESS>ADDRESS1</ADDRESS>=
TAG IS  =<ADDRESS>=
DATA IS =ADDRESS1=
FOR NUMBER =0003= ENTRY
XML IS  =<CITY>US</CITY>=
TAG IS  =<CITY>=
DATA IS =US=
FOR NUMBER =0004= ENTRY
XML IS  =<DATEOFBIRTH>1983-03-03</DATEOFBIRTH>=
TAG IS  =<DATEOFBIRTH>=
DATA IS =1983-03-03=
FOR NUMBER =0005= ENTRY
XML IS  =<LOCALECODE>VFC</LOCALECODE>=
TAG IS  =<LOCALECODE>=
DATA IS =VFC=
FOR NUMBER =0006= ENTRY
XML IS  =<NAMELINE>AYUSH</NAMELINE>=
TAG IS  =<NAMELINE>=
DATA IS =AYUSH=
FOR NUMBER =0007= ENTRY
XML IS  =<SEQUENCENUM>00000018</SEQUENCENUM>=
TAG IS  =<SEQUENCENUM>=
DATA IS =00000018=
FOR NUMBER =0008= ENTRY
XML IS  =<STATUSCODE>I</STATUSCODE>=
TAG IS  =<STATUSCODE>=
DATA IS =I=
FOR NUMBER =0009= ENTRY
XML IS  =<STATUS>MARRIED</STATUS>=
TAG IS  =<STATUS>=
DATA IS =MARRIED=
FOR NUMBER =0010= ENTRY
XML IS  =<MAILID>ABC</MAILID>=
TAG IS  =<MAILID>=
DATA IS =ABC=
FOR NUMBER =0011= ENTRY
XML IS  =<AGE>23</AGE>=
TAG IS  =<AGE>=
DATA IS =23=
FOR NUMBER =0012= ENTRY
XML IS  =<TELEPHONE>123456</TELEPHONE>=
TAG IS  =<TELEPHONE>=
DATA IS =123456=
FOR NUMBER =0013= ENTRY
XML IS  =<SEQUENCENUM>00000021</SEQUENCENUM>=
TAG IS  =<SEQUENCENUM>=
DATA IS =00000021=
FOR NUMBER =0014= ENTRY
XML IS  =<OCCUPATION>STUDENT</OCCUPATION>=
TAG IS  =<OCCUPATION>=
DATA IS =STUDENT=
FOR NUMBER =0015= ENTRY
XML IS  =<NAME>ABC</NAME>=
TAG IS  =<NAME>=
DATA IS =ABC=
FOR NUMBER =0016= ENTRY
XML IS  =<ADD>ADDRESS1</ADD>=
TAG IS  =<ADD>=
DATA IS =ADDRESS1=
FOR NUMBER =0017= ENTRY
XML IS  =<SEQUENCENUM>00000021</SEQUENCENUM>=
TAG IS  =<SEQUENCENUM>=
DATA IS =00000021=
FOR NUMBER =0018= ENTRY
XML IS  =<CITY>US</CITY>=
DATA IS =US=
FOR NUMBER =0019= ENTRY
XML IS  =<DATEOFBIRTH>1983-03-03</DATEOFBIRTH>=
TAG IS  =<DATEOFBIRTH>=
DATA IS =1983-03-03=
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts INVALID RECFM FOR DDNAME SYSLIN AND C... sandeep kumar302 All Other Mainframe Topics 7 Fri Apr 27, 2018 6:07 pm
No new posts Repeat Sequence Number Until change i... rahulabvp DFSORT/ICETOOL 6 Thu Mar 29, 2018 12:51 pm
No new posts Detect break in the sequence tuxama DFSORT/ICETOOL 6 Tue Mar 20, 2018 1:35 pm
No new posts add sequence number for duplicate rec... SRUTHI DRAVIDAMANI COBOL Programming 11 Thu Feb 22, 2018 5:37 pm
No new posts Need Guidance regarding UPDATE query Poha Eater DB2 3 Mon Feb 12, 2018 11:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us