{"title":"File.Pos() Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/file/file-pos-method/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/file/file-pos-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/file/file-pos-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Gets the current position of the file pointer in an ASCII or binary file.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":206,"chars":186},{"level":2,"title":"Parameters","slug":"parameters","at":392,"chars":85},{"level":2,"title":"Return Value","slug":"return-value","at":477,"chars":60},{"level":2,"title":"Remarks","slug":"remarks","at":537,"chars":80},{"level":2,"title":"Example","slug":"example","at":617,"chars":940},{"level":2,"title":"Related information","slug":"related-information","at":1557,"chars":132}],"text":"> Version: _Available or changed with runtime version 1.0._\nGets the current position of the file pointer in an ASCII or binary file.\n> NOTE\n> This method is supported only in Business Central on-premises.\n## Syntax\n```al\nPosition :=   File.Pos()\n```\n> NOTE\n> This method can be invoked using property access syntax.\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Parameters\nFile\nType: file-data-type\nAn instance of the file-data-type data type.\n## Return Value\nPosition\nType: ../integer/integer-data-type\n## Remarks\nThis method is often used with file-len-method and file-seek-method.\n## Example\nThe following example opens a text file that is named C:\\\\TestFolder\\\\TestFile.txt. The file-writemode-method enables the file to be open in write mode. The POS method retrieves the position of the file pointer and stores it in the Position variable. When the file is open, the position of the pointer is 0 because a pointer is not set. The file-seek-method method sets a file pointer at position 5. After the file-seek-method is executed, the POS method returns 5 as the file pointer position. This example assumes that you have created a text file named C:\\\\TestFolder\\\\TestFile.txt.\n```al\n var\n    Testfile: File;\n    Position: Integer;\nbegin\n    File.WriteMode(true);\n    TestFile.Open('C:\\TestFolder\\TestFile.txt');\n    Position := TestFile.Pos;\n    Message('Pointer position before Seek: %1', Position);\n    Testfile.Seek(5);\n    Position := Testfile.POS;\n    Message('Pointer position after Seek: %1', Position);\nend;\n```\n## Related information\nfile-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}